Skip to content

Instantly share code, notes, and snippets.

@stefanzweifel
Last active September 29, 2021 08:29
Show Gist options
  • Save stefanzweifel/3fb634b64dd58b8f66015483e1930f5e to your computer and use it in GitHub Desktop.
Save stefanzweifel/3fb634b64dd58b8f66015483e1930f5e to your computer and use it in GitHub Desktop.
GitHub Actions Workflows to run prettier and php-cs-fixer automatically
name: Format PHP
on:
pull_request:
paths:
- '*.php'
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install
run: composer install
- name: Run php-cs-fixer
run: ./vendor/bin/php-cs-fixer fix
- uses: stefanzweifel/git-auto-commit-action@v2.1.0
with:
commit_message: Apply php-cs-fixer changes
branch: ${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Format Prettier
on:
pull_request:
paths:
- '*.css'
- '*.js'
- '*.vue'
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install
run: yarn install
env:
CI: true
- name: Run prettier
run: yarn run prettier --write 'source/_assets/**/*.{scss,css,js,vue}' 'source/**/*.md'
- uses: stefanzweifel/git-auto-commit-action@v2.1.0
with:
commit_message: Apply prettier changes
branch: ${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment