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
pull/36426/head^2
Sarah French 1 year ago committed by GitHub
parent 2f0f537e69
commit 5508e9e72b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,9 +1,14 @@
# This workflow makes sure contributors don't forget to add a changelog entry or explicitly opt-out of it.
#
# 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.
# Instead, see use of workflow_run in https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
name: Changelog
on:
pull_request:
# The pull_request_target trigger event allows PRs raised from forks to have write permissions and access secrets.
# We uses it in this workflow to enable writing comments to the PR.
pull_request_target:
types:
- opened
- ready_for_review
@ -12,9 +17,9 @@ on:
- labeled
- unlabeled
# This workflow runs for not-yet-reviewed external contributions and so it
# intentionally has no write access and only limited read access to the
# repository.
# This workflow runs for not-yet-reviewed external contributions.
# Following a pull_request_target trigger the workflow would have write permissions,
# so we intentionally restrict the permissions to only include write access on pull-requests.
permissions:
contents: read
pull-requests: write
@ -155,4 +160,4 @@ jobs:
}
// Nothing to complain about, so delete any existing comment
await createOrUpdateChangelogComment("", true);
await createOrUpdateChangelogComment("", true);

Loading…
Cancel
Save