Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: PHP Composer

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
working-directory: ./app
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: ./app/vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
working-directory: ./app
run: composer install --prefer-dist --no-progress

- name: format code
run: bash commands php-cs-fixer
- name: Check for changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [ -n "$(git status --porcelain)" ]; then
echo "Formatting changes detected"
git add -A
git commit -m "chore: apply formatting" || echo "no commit"
git push origin HEAD:${{ github.head_ref }}
else
echo "No formatting changes"
fi