|
| 1 | +name: fixer |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + autofix: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup PHP |
| 18 | + uses: shivammathur/setup-php@v2 |
| 19 | + with: |
| 20 | + php-version: 8.2 |
| 21 | + extensions: bcmath |
| 22 | + env: |
| 23 | + runner: self-hosted |
| 24 | + |
| 25 | + - name: Validate composer.json and composer.lock |
| 26 | + run: composer validate --strict |
| 27 | + |
| 28 | + - name: Cache Composer packages |
| 29 | + id: composer-cache |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: vendor |
| 33 | + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-php- |
| 36 | +
|
| 37 | + - name: Install dependencies |
| 38 | + run: composer install --prefer-dist --no-progress |
| 39 | + |
| 40 | + - name: Run rector-fix |
| 41 | + run: composer rector-fix |
| 42 | + |
| 43 | + - name: Run ecs-fix |
| 44 | + run: composer ecs-fix |
| 45 | + |
| 46 | + - name: Run rector |
| 47 | + run: composer rector |
| 48 | + |
| 49 | + - name: Run ecs |
| 50 | + run: composer ecs |
| 51 | + |
| 52 | + - name: Run parabench |
| 53 | + run: composer parabench |
| 54 | + |
| 55 | + - name: "Check if build has changed" |
| 56 | + if: success() |
| 57 | + id: has-changes |
| 58 | + run: | |
| 59 | + echo "stdout<<EOF" >> $GITHUB_OUTPUT |
| 60 | + echo "$(git diff --stat)" >> $GITHUB_OUTPUT |
| 61 | + echo 'EOF' >> $GITHUB_OUTPUT |
| 62 | +
|
| 63 | + - name: Import GPG key |
| 64 | + if: ${{ steps.has-changes.outputs.stdout }} |
| 65 | + uses: crazy-max/ghaction-import-gpg@v6 |
| 66 | + with: |
| 67 | + gpg_private_key: ${{ secrets.GPG_BOT }} |
| 68 | + passphrase: ${{ secrets.GPG_PASSPHRASE }} |
| 69 | + fingerprint: ${{ secrets.GPG_FINGERPRINT }} |
| 70 | + git_config_global: true |
| 71 | + git_user_signingkey: true |
| 72 | + git_commit_gpgsign: true |
| 73 | + git_committer_name: Github bot |
| 74 | + git_committer_email: [email protected] |
| 75 | + |
| 76 | + - name: "Commit files" |
| 77 | + if: ${{ steps.has-changes.outputs.stdout }} |
| 78 | + env: |
| 79 | + GH_TOKEN: ${{ secrets.BOT_TOKEN }} |
| 80 | + run: | |
| 81 | + gh pr checkout ${{ github.event.pull_request.number }} |
| 82 | + git commit -S -m "autofix" -a |
| 83 | +
|
| 84 | + - name: "Push changes" |
| 85 | + if: ${{ steps.has-changes.outputs.stdout }} |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} |
| 88 | + run: git push -u origin HEAD |
0 commit comments