Skip to content

Commit

Permalink
Switch to running on pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Mar 8, 2024
1 parent 666f366 commit d2497d0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/coverage.yaml
@@ -1,6 +1,8 @@
name: coverage

on: [push]
on:
# this allows for `contents: write` and `pull-requests: write`
pull_request_target:

# limit default permissions to just readonly checkouts
permissions:
Expand All @@ -19,7 +21,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ matrix.branch == 'main' && 'main' || '' }}
# for safety, `pull_request_target` changes the default checkout to be the target branch, so we have to request the merge (we're limited to `permissions: {contents: read}`, so this is ok)
ref: ${{ matrix.branch == 'main' && 'main' || (github.event.pull_request && format('refs/pull/{0}/merge', github.event.pull_request.number)) || '' }}

- name: Bazel cache
id: bazel-cache
Expand Down

0 comments on commit d2497d0

Please sign in to comment.