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

[jfdi] Add phpcbf before lint #380

Merged
merged 21 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
abdd111
bump checkout version
jazzsequence Jul 18, 2024
5f812c8
move composer install to its own step
jazzsequence Jul 18, 2024
7af2714
add phpcbf job
jazzsequence Jul 18, 2024
a9de097
add perms so we can commit
jazzsequence Jul 18, 2024
678ad0e
make it all one action & allow push to fail
jazzsequence Jul 18, 2024
f9d681e
Update lint-test.yml to allow commit and push to fail if there are no…
jazzsequence Jul 18, 2024
f228382
use an existing action & workflow
jazzsequence Jul 18, 2024
e88d3a7
use our phpcs jobs but use the existing commit job
jazzsequence Jul 18, 2024
a385087
remove cbf from lint-test and go back to just linting
jazzsequence Jul 18, 2024
9759b0a
don't need write permissions anymore
jazzsequence Jul 18, 2024
a34afae
move phpcbf & commit to a separate workflow
jazzsequence Jul 18, 2024
78dcfe1
add a comment back to the PR if the robot made changes
jazzsequence Jul 18, 2024
9453e70
intentionally break linting
jazzsequence Jul 18, 2024
9a77e3a
allow the workflow to continue when phpcbf returns error code 1
jazzsequence Jul 18, 2024
6c15724
remove branch
jazzsequence Jul 18, 2024
22dc5f6
take out the third party action for the commit
jazzsequence Jul 18, 2024
d9d6d09
we need to actually push the changes
jazzsequence Jul 18, 2024
9cf633c
another intentional bad code change
jazzsequence Jul 18, 2024
8fa0864
fix destination to push to
jazzsequence Jul 18, 2024
6e987f6
explicitly use the pr head ref
jazzsequence Jul 18, 2024
6d7babc
PHPCBF: Fix coding standards
Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: pantheon-systems/validate-readme-spacing@v1
wporg-validation:
name: WP.org Validator
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: WP.org Validator
uses: pantheon-systems/action-wporg-validator@1.0.0
with:
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Lint
run: |
composer install
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/phpcbf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PHP Code Beautifier
on: [pull_request]
permissions:
contents: write
pull-requests: write
jobs:
phpcbf:
name: PHPCBF & Commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install Composer dependencies and run PHPCBF
run: |
composer install
composer phpcbf || true # Allow the workflow to continue even if PHPCBF fails
- name: Commit changes to PR
id: git-auto-commit
run: |
git config --global user.email "bot@getpantheon.com"
git config --global user.name "Pantheon Robot"
DIFF=$(git diff-index --quiet HEAD || echo "true")
if [ "$DIFF" == "true" ]; then
git add .
git commit -m "PHPCBF: Fix coding standards" --no-verify
git push origin ${{ github.event.pull_request.head.ref }}
echo "changes_detected=true" >> $GITHUB_ENV
else
echo "changes_detected=false" >> $GITHUB_ENV
fi
- name: Add PR Comment
if: env.changes_detected == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
CURRENT_COMMIT=$(git rev-parse --short HEAD)
gh pr comment ${{ github.event.pull_request.number }} -b "Hi from your friendly robot! :robot: I fixed PHPCS issues with \`phpcbf\` on $CURRENT_COMMIT. Please review the changes."