diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 6eb08d942..4277c4955 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -84,6 +84,7 @@ jobs: fail-fast: false matrix: php: [ '8.1' ] + if: github.event_name == 'pull_request' || github.event_name == 'push' steps: - name: Checkout uses: actions/checkout@v3 @@ -101,12 +102,20 @@ jobs: coverage: pcov extensions: ctype, iconv, xml + - name: Configure the base ref (pull request) + if: github.event_name == 'pull_request' + run: echo "INFECTION_BASE_REF=$GITHUB_BASE_REF" >> $GITHUB_ENV + + - name: Configure the base ref (push/release event) + if: github.event_name == 'push' + run: echo "INFECTION_BASE_REF=${{ github.event.before }}" >> $GITHUB_ENV + # Do this before using the Makefile just to avoid accidentally resolving the deferred variables using # INFECTION_FLAGS. - name: Configure Infection for the CI run: | - git fetch origin $GITHUB_BASE_REF - echo "INFECTION_FLAGS=--git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --ignore-msi-with-no-mutations --logger-github" >> "$GITHUB_ENV" + git fetch origin $INFECTION_BASE_REF + echo "INFECTION_FLAGS=--git-diff-lines --git-diff-base=origin/$INFECTION_BASE_REF --ignore-msi-with-no-mutations --logger-github" >> "$GITHUB_ENV" - name: Install Composer dependencies uses: ramsey/composer-install@v2