-
Notifications
You must be signed in to change notification settings - Fork 7
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
Upgrade the branch-label
action to use Node.js v20
#122
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,43 @@ See [action.yml](action.yml) | |
|
||
```yaml | ||
on: | ||
pull_request: | ||
pull_request_target: | ||
types: opened | ||
|
||
jobs: | ||
SetLabels: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Labels | ||
uses: woocommerce/grow/branch-label@actions-v1 | ||
uses: woocommerce/grow/branch-label@actions-v2 | ||
``` | ||
|
||
#### Permissions: | ||
|
||
It's recommended to use the `pull_request_target` event instead of `pull_request` to avoid the issue of not having permission to add labels to pull requests. | ||
|
||
Ref: | ||
- https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target | ||
- https://github.com/actions/labeler/tree/v5#permissions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we are using the labeler action, I think this link can be useful too: https://github.com/actions/labeler?tab=readme-ov-file#usage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 424eada. |
||
|
||
## Migration from v1 to v2: | ||
|
||
```diff | ||
- pull_request: | ||
+ pull_request_target: | ||
types: opened | ||
|
||
jobs: | ||
SetLabels: | ||
+ permissions: | ||
+ contents: read | ||
+ pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Labels | ||
- uses: woocommerce/grow/branch-label@actions-v1 | ||
+ uses: woocommerce/grow/branch-label@actions-v2 | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"changelog: breaking": | ||
- head-branch: "^breaking/" | ||
|
||
"changelog: add": &head-branch-add | ||
- head-branch: "^add/" | ||
|
||
"changelog: update": | ||
- head-branch: "^update/" | ||
|
||
"changelog: fix": &head-branch-fix | ||
- head-branch: "^fix/" | ||
|
||
"changelog: tweak": | ||
- head-branch: "^tweak/" | ||
|
||
"changelog: dev": | ||
- head-branch: "^dev/" | ||
|
||
"changelog: doc": &head-branch-doc | ||
- head-branch: "^doc/" | ||
|
||
"changelog: none": | ||
- head-branch: "^release/" | ||
|
||
"type: enhancement": *head-branch-add | ||
"type: bug": *head-branch-fix | ||
"type: documentation": *head-branch-doc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this action, we're not directly interacting with the code from the PR, so we're OK. However, shouldn't we also mention here that
pull_request_target
will grant access to secrets for PRs from forks?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Added in 424eada.