Skip to content

Commit

Permalink
Stop using 'push' event to determine privileged post-submit runs.
Browse files Browse the repository at this point in the history
Both 'schedule' and 'workflow_dispatch' are valid alternatives today.  What we really want here is anything *except* pull request events.

PiperOrigin-RevId: 509123777
  • Loading branch information
mkruskal-google committed Feb 14, 2023
1 parent 0da35b1 commit a3970ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/actions/bazel-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ runs:

- name: Save Bazel repository cache
# Only allow repository cache updates during post-submits.
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
uses: ./.github/actions/internal/repository-cache-save
6 changes: 3 additions & 3 deletions .github/actions/bazel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ runs:
run: echo "BAZELISK_PATH=$LOCALAPPDATA\bazelisk" >> $GITHUB_ENV

- name: Cache Bazelisk
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: ${{ env.BAZELISK_PATH }}
key: bazel-${{ runner.os }}-${{ inputs.version }}

- name: Restore Bazelisk
if: ${{ github.event_name != 'push' }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
uses: actions/cache/restore@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: ${{ env.BAZELISK_PATH }}
Expand Down Expand Up @@ -107,5 +107,5 @@ runs:

- name: Save Bazel repository cache
# Only allow repository cache updates during post-submits.
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target'}}
uses: ./.github/actions/internal/repository-cache-save
3 changes: 2 additions & 1 deletion .github/workflows/test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ jobs:
# repository, it's safe and we can use `pull_request`. Otherwise, we should
# use `pull_request_target`.
if: |
(github.event_name == 'push' &&
(github.event_name != 'pull_request' &&
github.event_name != 'pull_request_target' &&
github.event.repository.full_name == 'protocolbuffers/protobuf') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == 'protocolbuffers/protobuf') ||
Expand Down

0 comments on commit a3970ef

Please sign in to comment.