Skip to content

Instantly share code, notes, and snippets.

@dib258
Created February 3, 2022 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dib258/7f3d511a8b53a7cb9fa40e3b38732d50 to your computer and use it in GitHub Desktop.
Save dib258/7f3d511a8b53a7cb9fa40e3b38732d50 to your computer and use it in GitHub Desktop.
Github Action file that use php-cs-fixer to lint project on the repository
name: PHP-CS-Fixer Lint
on: [push]
jobs:
php-linter:
name: PHP Linter
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix php styling
branch: ${{ steps.extract_branch.outputs.branch }}
commit_options: '--no-verify'
commit_user_name: GitHub Actions Bot # defaults to "GitHub Actions"
commit_user_email: github-actions-bot@chillpills.io # defaults to "actions@github.com"
commit_author: GitHub Actions Bot <github-actions-bot@chillpills.io> # defaults to author of the commit that triggered the run
# Optional. Disable dirty check and always try to create a commit and push
skip_dirty_check: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment