Skip to content

Commit

Permalink
Fallback to github-actions bot user
Browse files Browse the repository at this point in the history
If we are unable to find the login for the current token, fallback to `github-actions[bot]`. 

Failure to get the user for the github-runner token has been seen with GHES. This will allow PR comments to be created anyway - and if the token does belong the the github-actions app everything will work as it should.

If the token does not belong to the github-actions app and github still won't tell us who it belongs to, then applies will fail to find the comment. But there's not much we can do about that.
  • Loading branch information
dflook authored Jul 20, 2023
1 parent 4f09ac4 commit 168093f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion image/src/github_pr_comment/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ def rest() -> Optional[str]:
username = graphql() or rest()

if username is None:
raise Exception('Unable to get username for the github token')
debug('Unable to get username for the github token')
username = 'github-actions[bot]'

job_cache[cache_key] = username

Expand Down

0 comments on commit 168093f

Please sign in to comment.