Skip to content

Update composer-require-checker #87

Update composer-require-checker

Update composer-require-checker #87

Workflow file for this run

# Update this by running
# curl https://gist.githubusercontent.com/mpdude/ca93a185bcbf56eb7e341632ad4f8263/raw/fix-cs-php.yml > .github/workflows/fix-cs-php.yml
on:
push:
branches:
- master
pull_request:
name: Coding Standards
jobs:
open-pr-for-cs-violations:
name: PHP-CS-Fixer
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Run PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga:3.11.0
- name: Create PR for CS fixups
uses: peter-evans/create-pull-request@c7f493a8000b8aeb17a1332e326ba76b57cb83eb
id: create-pull-request
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: Fix coding standards in ${{ github.ref }}
branch: php-cs-fixer/${{ github.ref }}
assignees: ${{ github.actor }}
labels: php-cs-fixer
body: Please merge these changes into the ${{ github.ref }} branch to fix coding standard violations.
commit-message: Apply php-cs-fixer changes as of ${{ github.sha }}
- name: Leave a notice in the discussion when fixing code in a Pull Request
uses: docker://mpdude/comment-on-pr:v1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.create-pull-request.outputs.pr_number # only if PR was created in the previous step
continue-on-error: true # continue on failure - necessary when the current branch does not have a pending PR
with:
msg: |
@${{ github.actor }} please apply the coding standard fixes from #${{ steps.create-pull-request.outputs.pr_number }}
- name: Fail the workflow when necessary CS fixes were detected
run: echo "Failing workflow run because CS violations were detected." && exit 1
if: steps.create-pull-request.outputs.pr_number