Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give write access to backport action explicitly #61626

Merged
merged 1 commit into from
Nov 15, 2021
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
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
Member

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
Member

@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