diff --git a/openedx_webhooks/views/github.py b/openedx_webhooks/views/github.py index cbde4a5a..e97c96f3 100644 --- a/openedx_webhooks/views/github.py +++ b/openedx_webhooks/views/github.py @@ -177,6 +177,12 @@ def pr_opened(pr, bugsnag_context=None): comment_resp = github.post(url, json=comment) if not comment_resp.ok: raise requests.exceptions.RequestException(comment_resp.text) + + issue_url = "/repos/{repo}/issues/{num}".format(repo=repo, num=pr["number"]) + label_resp = github.patch(issue_url, data=json.dumps({"labels": ["needs triage"]})) + if not label_resp.ok: + raise requests.exceptions.RequestException(label_resp.text) + print( "@{user} opened PR #{num} against {repo}, created {issue} to track it".format( user=user, repo=repo, diff --git a/openedx_webhooks/views/jira.py b/openedx_webhooks/views/jira.py index 16889fbc..67967af2 100644 --- a/openedx_webhooks/views/jira.py +++ b/openedx_webhooks/views/jira.py @@ -29,35 +29,14 @@ def get_jira_custom_fields(): if value["custom"] } -# Maps JIRA status : Github label dictionary -# TODO: should load this directly from labels.yaml so the color and name info is up to date. -# Doesn't have the URL info but that is easily constructed. +# Maps JIRA status : Github label name STATUS_LABEL_DICT = { - 'Product Review': { - "url": "https://api.github.com/repos/edx/edx-platform/labels/product+review", - "name": "product review", - "color": "5319e7" - }, - 'Community Manager Review': { - "url": "https://api.github.com/repos/edx/edx-platform/labels/community+manager+review", - "name": "community manager review", - "color": "207de5" - }, - 'Awaiting Prioritization': { - 'url': 'https://api.github.com/repos/edx/edx-platform/labels/awaiting+prioritization', - 'name': 'awaiting prioritization', - 'color': 'fad8c7' - }, - 'Engineering Review': { - "url": "https://api.github.com/repos/edx/edx-platform/labels/community+manager+review", - "name": "community manager review", - "color": "207de5" - }, - 'Waiting on Author': { - "url": "https://api.github.com/repos/edx/edx-platform/labels/waiting+on+author", - "name": "waiting on author", - "color": "0052cc" - }, + 'Needs Triage': "needs triage", + 'Product Review': "product review", + 'Community Manager Review': "community manager review", + 'Awaiting Prioritization': "awaiting prioritization", + 'Engineering Review': "engineering review", + 'Waiting on Author': "waiting on author", }