Skip to content

Fixed code-style

Fixed code-style #222

Workflow file for this run

name: Code Style
on: [ push, pull_request ]
permissions: write-all
jobs:
style:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Detect job name
id: detect
run: |
[[ ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} ]] && NAME="Fix" || NAME="Check"
echo "name=${NAME}" >> $GITHUB_OUTPUT
- name: ${{ steps.detect.outputs.name }} the code style
uses: TheDragonCode/codestyler@v3
with:
github_token: ${{ secrets.COMPOSER_TOKEN }}
fix: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
normalize:
needs: style
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
file:
- src/Core
- src/Cash
- src/SberAuth
- src/SberOnline
- src/SberQrCode
- src/TinkoffAuth
- src/TinkoffCredit
- src/TinkoffOnline
- src/TinkoffQrCode
- src/TemplateDriver
- src/TemplateDriverAuth
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- name: Git setup
if: success()
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Install dependency
run: composer global require ergebnis/composer-normalize
- name: Normalize composer.json
id: normalizer
run: |
IS_DIRTY=1
composer normalize ${{ matrix.file }}/composer.json
{ git add . && git commit -a -m "Normalized \`composer.json\` files"; } || IS_DIRTY_0
echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT
- name: Push changes
uses: ad-m/github-push-action@master
if: steps.normalizer.outputs.is_dirty == 1
with:
github_token: ${{ secrets.COMPOSER_TOKEN }}