Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run PHPCBF before PHPCS in GitHub Actions #23

Open
1 task done
BrianHenryIE opened this issue Sep 1, 2022 · 0 comments
Open
1 task done

Run PHPCBF before PHPCS in GitHub Actions #23

BrianHenryIE opened this issue Sep 1, 2022 · 0 comments

Comments

@BrianHenryIE
Copy link
Member

BrianHenryIE commented Sep 1, 2022

Feature Request

Describe your use case and the problem you are facing

When I forget to run PHPCBF before making a pull request, errors that can be fixed automatically are flagged by PHPCS for manual review.

Describe the solution you'd like

In the code-quality.yml GitHub Action, PHPCBF should be run before PHPCS:

- name: Run PHPCBF to fix what it can
  continue-on-error: true
  run: vendor/bin/phpcbf

- name: Run PHPCS and add annotations to the code
  run: vendor/bin/phpcs -q -n --report=checkstyle | cs2pr

At some point the PHPCBF changes need to be committed. This could be immediately after PHPCBF is run but would mean contributors need to pull changes before they can push again, (I see a note in my own yml: "NB: Pull requests from forks do not have access to repository secrets so cannot commit changes.") so maybe on every commit to master PHPCBF plus a commit should be run:

on:
  push:
    branches:
      - master

...

- name: Commit PHPCBF changes
  uses: stefanzweifel/[email protected]
  with:
    commit_message: "🤖 PHPCBF"
@danielbachhuber danielbachhuber transferred this issue from wp-cli/wp-cli-tests Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants