Skip to content
Merged
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
Give write access to backport action explicitly
  • Loading branch information
hoyosjs authored Nov 15, 2021
commit d3bff31488d73bf2f044d38521a22cb6f024cf73
5 changes: 5 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
issue_comment:
types: [created]

permissions:
contents: write
issues: read
pull-requests: write
Copy link
Contributor

Choose a reason for hiding this comment

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

@hoyosjs I get pull-requests: write but why is write needed for contents or read for issues

Copy link
Contributor

@dougbu dougbu Nov 15, 2021

Choose a reason for hiding this comment

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

I expected

permissions:
  contents: read
  pull-requests: write

Copy link
Member

Choose a reason for hiding this comment

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

All comments fall under "issues" in the GitHub API IIRC, even PR comments, so that's why read is required for issues.

write is probably required for contents since this workflow creates a new branch and commits as part of how it functions.

Copy link
Member

Choose a reason for hiding this comment

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

pull-requests: write is only for the explicit action to create the pull request from one branch to another.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, exactly those scopes are why I gave it those permissions. @vcsjones do you know if this is correct?

Copy link
Member

Choose a reason for hiding this comment

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

You might need write on issues because the backport bot leaves a comment on PRs (like these) that the back port has been started. @jkoritzinsky is right, PR comments are "issues" (also evidence of this that this backport bot triggers on issue_comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I forgot about the reply. Much appreciated @vcsjones


jobs:
backport:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/backport to')
Expand Down