Skip to content

PHPCSFixer

PHPCSFixer #10

Workflow file for this run

name: PHPCSFixer
on:
workflow_dispatch:
inputs:
id:
description: "Execution ID"
required: true
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
id: fetch-token
uses: FriendsOfShopware/automation-bot/actions/fetch-token@main
with:
id: "${{ inputs.id }}"
- uses: actions/checkout@v4
with:
repository: "${{ inputs.owner }}/${{ inputs.repo }}"
ref: "${{ inputs.branch }}"
token: ${{ steps.fetch-token.outputs.token }}
- 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