Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions openedx_webhooks/views/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ def pr_opened(pr, bugsnag_context=None):
comment_resp = github.post(url, data=json.dumps(comment))
if not comment_resp.ok:
raise requests.exceptions.RequestException(comment_resp.text)
needs_triage_label = {
"url": "https://api.github.com/repos/edx/edx-platform/labels/needs+triage",
"name": "needs triage",
"color": "e11d21"
}

label_resp = github.patch(issue_url, data=json.dumps({"labels": [needs_triage_label]}))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is issue_url defined? And are you sure this is the URL for the Github issue, rather than the JIRA issue? Also, the API endpoint docs say that the labels attribute should be a list of strings, not a list of JSON objects: https://developer.github.com/v3/issues/#edit-an-issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o yes this is why code review is good. That means a lot of the stuff from #6 is broken too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suck at reading API doc apparently! sheesh. Um, what is "push access" and does the bot have it? Because remember how when you log in as edx-jira there's no "Merge" button? So perhaps edx-jira doesn't have push access, and that's why closing the PR from JIRA is failing, and would also mean changing these labels will fail.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarina ah, that would make sense. Sounds like "push access" refers to permission levels for accounts: https://help.github.com/articles/permission-levels-for-an-organization-repository

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singingwolfboy can you give botbro's account write access, then? I don't think I can, I'm not a Github admin

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,
Expand Down
11 changes: 8 additions & 3 deletions openedx_webhooks/views/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def get_jira_custom_fields():
# 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.
STATUS_LABEL_DICT = {
'Needs Triage': {
"url": "https://api.github.com/repos/edx/edx-platform/labels/needs+triage",
"name": "needs triage",
"color": "e11d21"
},
'Product Review': {
"url": "https://api.github.com/repos/edx/edx-platform/labels/product+review",
"name": "product review",
Expand All @@ -48,9 +53,9 @@ def get_jira_custom_fields():
'color': 'fad8c7'
},
'Engineering Review': {
"url": "https://api.github.com/repos/edx/edx-platform/labels/community+manager+review",
"name": "community manager review",
"color": "207de5"
"url": "https://api.github.com/repos/edx/edx-platform/labels/engineering+review",
"name": "engineering review",
"color": "c7def8"
},
'Waiting on Author': {
"url": "https://api.github.com/repos/edx/edx-platform/labels/waiting+on+author",
Expand Down