Skip to content

Commit

Permalink
ci: Fix infection on non-pull requests (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Mar 4, 2023
1 parent d2b9881 commit 9b6ffe2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9b6ffe2

Please sign in to comment.