Skip to content

Commit

Permalink
Improve Pint integration in CI workflow
Browse files Browse the repository at this point in the history
This commit refines the Pint code style check by adding a conditional check based on the outcome of the pint-check step. It restructures the Pint fixes application to include a rebase before pushing changes to avoid conflicts.
  • Loading branch information
midnite81 committed Oct 6, 2024
1 parent de380a2 commit 69f18c8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
php-version: ['8.2', '8.3']
php-version: [ '8.2', '8.3' ]
include:
- php-version: '8.3'
latest: true
Expand Down Expand Up @@ -51,17 +51,22 @@ jobs:

- name: Check code style with Pint
if: matrix.latest == true
id: pint-check
run: composer run pint -- --test
continue-on-error: true

- name: Apply Pint fixes
if: failure() && matrix.latest == true
if: matrix.latest == true && steps.pint-check.outcome == 'failure'
run: |
composer run pint
git config --local user.name "GitHub Actions"
git config --local user.email "[email protected]"
git commit -am "Apply Pint fixes" || echo "No changes to commit"
git push origin HEAD:${{ github.event.pull_request.head.ref || github.ref }}
git add .
git diff --staged --quiet || {
git commit -m "Apply Pint fixes"
git pull --rebase origin ${{ github.head_ref || github.ref_name }}
git push origin HEAD:${{ github.head_ref || github.ref_name }}
}
phpstan:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 69f18c8

Please sign in to comment.