Skip to content

Commit 5508e9e

Browse files
authored
Update changelog.yml so there are necessary permissions to run on PRs from forked repos (#36434)
* Update changelog.yml to use pull_request_target trigger events * Add comments about use of pull_request_target and permissions
1 parent 2f0f537 commit 5508e9e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/changelog.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# This workflow makes sure contributors don't forget to add a changelog entry or explicitly opt-out of it.
2+
#
3+
# Do not extend this workflow to include checking out the code (e.g. for building and testing purposes) while the pull_request_target trigger is used.
4+
# Instead, see use of workflow_run in https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
25

36
name: Changelog
47

58
on:
6-
pull_request:
9+
# The pull_request_target trigger event allows PRs raised from forks to have write permissions and access secrets.
10+
# We uses it in this workflow to enable writing comments to the PR.
11+
pull_request_target:
712
types:
813
- opened
914
- ready_for_review
@@ -12,9 +17,9 @@ on:
1217
- labeled
1318
- unlabeled
1419

15-
# This workflow runs for not-yet-reviewed external contributions and so it
16-
# intentionally has no write access and only limited read access to the
17-
# repository.
20+
# This workflow runs for not-yet-reviewed external contributions.
21+
# Following a pull_request_target trigger the workflow would have write permissions,
22+
# so we intentionally restrict the permissions to only include write access on pull-requests.
1823
permissions:
1924
contents: read
2025
pull-requests: write
@@ -155,4 +160,4 @@ jobs:
155160
}
156161
157162
// Nothing to complain about, so delete any existing comment
158-
await createOrUpdateChangelogComment("", true);
163+
await createOrUpdateChangelogComment("", true);

0 commit comments

Comments
 (0)