diff --git a/.github/actions/bazel-docker/action.yml b/.github/actions/bazel-docker/action.yml index 800d8eca24b90..af1104e23df83 100644 --- a/.github/actions/bazel-docker/action.yml +++ b/.github/actions/bazel-docker/action.yml @@ -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 diff --git a/.github/actions/bazel/action.yml b/.github/actions/bazel/action.yml index a848cfc394aaa..141527db0267d 100644 --- a/.github/actions/bazel/action.yml +++ b/.github/actions/bazel/action.yml @@ -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 }} @@ -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 diff --git a/.github/workflows/test_runner.yml b/.github/workflows/test_runner.yml index 3d674013efcd9..9318af0077523 100644 --- a/.github/workflows/test_runner.yml +++ b/.github/workflows/test_runner.yml @@ -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') ||