PHPCSFixer #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHPCSFixer | |
on: | |
workflow_dispatch: | |
inputs: | |
owner: | |
description: 'Owner of the repo' | |
required: true | |
repo: | |
description: 'Repo to run against' | |
required: true | |
branch: | |
description: 'Branch to run against' | |
required: true | |
default: main | |
php-version: | |
description: 'PHP version to use' | |
required: true | |
default: "8.2" | |
rules: | |
description: 'Rules to use' | |
required: true | |
default: "@PER-CS2.0,no_unused_imports" | |
permissions: | |
id-token: write | |
jobs: | |
fix_codestyle: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch scoped token | |
uses: FriendsOfShopware/automation-bot/actions/fetch-token@main | |
- uses: actions/checkout@v4 | |
with: | |
repository: "${{ inputs.owner }}/${{ inputs.repo }}" | |
ref: "${{ inputs.branch }}" | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ inputs.php-version }}" | |
tools: php-cs-fixer | |
- name: Run CSFixer | |
run: | | |
php-cs-fixer fix . --rules="${{ inputs.rules }}" | |
if ! git diff HEAD --quiet; then | |
githubUsername="frosh-automation" | |
githubId="188718289" | |
githubEmail="${githubId}+${githubUsername}[bot]@users.noreply.github.com" | |
git config --global user.name "${githubUsername}" | |
git config --global user.email "${githubEmail}" | |
git add . | |
git commit -m "fix: code-style" | |
git push origin "HEAD:${{ inputs.branch }}" | |
fi | |