Skip to content

Commit a3970ef

Browse files
Stop using 'push' event to determine privileged post-submit runs.
Both 'schedule' and 'workflow_dispatch' are valid alternatives today. What we really want here is anything *except* pull request events. PiperOrigin-RevId: 509123777
1 parent 0da35b1 commit a3970ef

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

.github/actions/bazel-docker/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ runs:
7171

7272
- name: Save Bazel repository cache
7373
# Only allow repository cache updates during post-submits.
74-
if: ${{ github.event_name == 'push' }}
74+
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
7575
uses: ./.github/actions/internal/repository-cache-save

.github/actions/bazel/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ runs:
6363
run: echo "BAZELISK_PATH=$LOCALAPPDATA\bazelisk" >> $GITHUB_ENV
6464

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

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

108108
- name: Save Bazel repository cache
109109
# Only allow repository cache updates during post-submits.
110-
if: ${{ github.event_name == 'push' }}
110+
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target'}}
111111
uses: ./.github/actions/internal/repository-cache-save

.github/workflows/test_runner.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ jobs:
5757
# repository, it's safe and we can use `pull_request`. Otherwise, we should
5858
# use `pull_request_target`.
5959
if: |
60-
(github.event_name == 'push' &&
60+
(github.event_name != 'pull_request' &&
61+
github.event_name != 'pull_request_target' &&
6162
github.event.repository.full_name == 'protocolbuffers/protobuf') ||
6263
(github.event_name == 'pull_request' &&
6364
github.event.pull_request.head.repo.full_name == 'protocolbuffers/protobuf') ||

0 commit comments

Comments
 (0)