Skip to content

Commit

Permalink
publish_toolstate.py: further fix the runtime errors
Browse files Browse the repository at this point in the history
The regex was missing a `,`, causing `relevant_pr_match` to become None
and set the PR number to -1 and assigned the new issue to
`@<unknown user>`. This causes the 422 error when creating the issue due
to invalid assignee and unable to leave the tool-is-broken comment since
PR -1 does not exist.

The default user names are now also changed to @ghost to prevent the
422 error in case anything goes wrong again.
  • Loading branch information
kennytm committed Feb 17, 2019
1 parent 8af675a commit 66ae313
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tools/publish_toolstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def update_latest(

# assume that PR authors are also owners of the repo where the branch lives
relevant_pr_match = re.search(
'Auto merge of #([0-9]+) - ([^:]+):[^,]+ r=([^\s]+)',
r'Auto merge of #([0-9]+) - ([^:]+):[^,]+, r=(\S+)',
cur_commit_msg,
)
if relevant_pr_match:
Expand All @@ -182,10 +182,10 @@ def update_latest(
pr_reviewer = relevant_pr_match.group(3)
else:
number = '-1'
relevant_pr_user = '<unknown user>'
relevant_pr_user = 'ghost'
relevant_pr_number = '<unknown PR>'
relevant_pr_url = '<unknown>'
pr_reviewer = '<unknown reviewer>'
pr_reviewer = 'ghost'

message = update_latest(
cur_commit,
Expand Down

0 comments on commit 66ae313

Please sign in to comment.