Skip to content

Commit

Permalink
CI: go.work sync: use pull_request_target
Browse files Browse the repository at this point in the history
We seem to be having issues accessing secrets in the workflow even though
we only process pull requests from the same repository (where documentation
claims secrets should be available).  Switch to using `pull_request_target`
to try to get access to those secrets.

Since we still only run this job if the pull request is from the same
repository (with an explicit manual check), this should still be safe as it
only applies to people with write access to the repository.

Signed-off-by: Mark Yen <mark.yen@suse.com>
  • Loading branch information
mook-as committed Jun 6, 2024
1 parent aed6cfc commit 1db5ded
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/go-work-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: Sync go.work
on:
pull_request:
pull_request_target:
types: [ opened, reopened, synchronize ]
paths:
- '**/go.mod'
Expand All @@ -17,9 +17,9 @@ concurrency:
cancel-in-progress: true
jobs:
update-sum:
if: >-
contains(github.ref, 'refs/pull/') &&
github.event.pull_request.head.repo.full_name == github.repository
# We only run this for pull requests from the same repository. This is
# important for security reasons, as we use pull_request_target.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
# Because the GitHub-provided token doesn't trigger further actions runs,
Expand Down

0 comments on commit 1db5ded

Please sign in to comment.