Skip to content

Instantly share code, notes, and snippets.

@mpdude
Last active November 21, 2025 18:49
Show Gist options
  • Select an option

  • Save mpdude/804005e2bc7717bc36e4def876a5303d to your computer and use it in GitHub Desktop.

Select an option

Save mpdude/804005e2bc7717bc36e4def876a5303d to your computer and use it in GitHub Desktop.
Run PHP-CS-Fixer on PRs and commit/push back changes
# Update this by running
# curl https://gist.githubusercontent.com/mpdude/804005e2bc7717bc36e4def876a5303d/raw/fix-php-cs.yml > .github/workflows/fix-cs-php.yml
name: Coding Standards
on:
push:
branches:
- master
pull_request:
jobs:
fix-cs-violations:
name: Apply PHP-CS-Fixer
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Run PHP-CS-Fixer
uses: docker://ghcr.io/php-cs-fixer/php-cs-fixer:3.89.2-php8.4
with:
args: "fix --show-progress=dots"
- name: Commit and push back changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Fix CS with PHP-CS-Fixer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment