Skip to content

Instantly share code, notes, and snippets.

@mpdude
Last active August 27, 2024 07:31
Show Gist options
  • Save mpdude/ca93a185bcbf56eb7e341632ad4f8263 to your computer and use it in GitHub Desktop.
Save mpdude/ca93a185bcbf56eb7e341632ad4f8263 to your computer and use it in GitHub Desktop.
GitHub Actions workflow to run PHP-CS-Fixer and push changes back to the branch
# Update this by running
# curl https://gist.github.com/mpdude/ca93a185bcbf56eb7e341632ad4f8263/raw/fix-cs-php.yml > .github/workflows/fix-cs-php.yml
on:
push:
branches:
- master
pull_request:
name: Coding Standards
jobs:
fix-cs-issues:
name: PHP-CS-Fixer
runs-on: ubuntu-22.04
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.62.0-php8.3
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