humhub/.github/workflows/php-cs-fixer.yml
Yuriy Bakhtin 510e623ddb
Add GitHub action for PHP CS Fixer (#7070)
* Add GitHub action for PHP CS Fixer

* PHP CS Fixer: use cache

* Autocommit changes

* Autocommit PHP CS Fixer

* Update CHANGELOG-DEV.md

* Implement [SKIP-PHPCS] for commit text

* Improve skipping for [SKIP-PHPCS]

* Improve skipping for [SKIP-PHPCS]

* Improve skipping for [SKIP-PHPCS]

* Improve skipping for [SKIP-PHPCS]

* Improve skipping for [SKIP-PHPCS]

* Improve skipping for [SKIP-PHPCS] (replace deprecated set-output)

* Test php cs fixer

* Autocommit PHP CS Fixer

* Fix flag [SKIP-PHPCS] for commit text
2024-06-28 08:36:54 +00:00

41 lines
1.3 KiB
YAML

name: PHP CS Fixer
on: [push]
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check the commit message for skipping PHP-CS-Fixer
id: check_phpcs_skip
run: |
if git log -1 --pretty=%B | grep -q '\[SKIP-PHPCS\]'; then
echo "skip=true" >> $GITHUB_OUTPUT
echo "Skip PHP-CS-Fixer because the commit message contains [SKIP-PHPCS]."
else
echo "skip=false" >> $GITHUB_OUTPUT
echo "Proceeding with PHP-CS-Fixer steps."
fi
- uses: actions/cache@v3
if: steps.check_phpcs_skip.outputs.skip == 'false'
with:
path: .php-cs-fixer.cache
key: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-${{ github.sha }}
restore-keys: |
${{ runner.OS }}-${{ github.repository }}-phpcsfixer-
- name: Run PHP-CS-Fixer
if: steps.check_phpcs_skip.outputs.skip == 'false'
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.php
- name: Auto commit changes
if: steps.check_phpcs_skip.outputs.skip == 'false'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Autocommit PHP CS Fixer