diff --git a/.github/workflows/reusable-lint-py.yml b/.github/workflows/reusable-lint-py.yml index ca969bad0..a2dbb1e99 100644 --- a/.github/workflows/reusable-lint-py.yml +++ b/.github/workflows/reusable-lint-py.yml @@ -36,7 +36,8 @@ jobs: - name: Set up Python venv uses: ./repo/.github/actions/setup-venv with: - save: ${{ github.ref == 'refs/heads/master' }} + # Check the event too: 'github.ref' is the base branch on a closed pull request + save: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} - name: Lint run: |- diff --git a/.github/workflows/reusable-test.yml b/.github/workflows/reusable-test.yml index 93000d445..e8981e899 100644 --- a/.github/workflows/reusable-test.yml +++ b/.github/workflows/reusable-test.yml @@ -92,7 +92,8 @@ jobs: - name: Set up Python venv uses: ./repo/.github/actions/setup-venv with: - save: ${{ github.ref == 'refs/heads/master' }} + # Check the event too: 'github.ref' is the base branch on a closed pull request + save: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} - name: Test id: run-test @@ -125,7 +126,7 @@ jobs: path: ${{ env.CCACHE_DIR }} key: ${{ steps.ccache.outputs.key }} # Keep master's cache around longer; PR/branch caches churn faster - retention-days: ${{ github.ref == 'refs/heads/master' && 7 || 3 }} + retention-days: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && 7 || 3 }} - name: Fail job if a test failed if: ${{ steps.run-test.outcome == 'failure' && !cancelled() }}