-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SITE-1140] fix subdirectory paths (#143)
* port changes from #142 * remove no-longer-necessary id Co-authored-by: Phil Tyler <[email protected]> * execute and test in one step (instead of two) Co-authored-by: Phil Tyler <[email protected]> * remove the DIFF variable don't need it Co-authored-by: Phil Tyler <[email protected]> --------- Co-authored-by: Phil Tyler <[email protected]>
- Loading branch information
1 parent
9873c99
commit 36d2576
Showing
2 changed files
with
46 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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: | | ||
CBF=false | ||
composer install | ||
if ! composer lint:phpcbf; then | ||
echo "cbf=true" >> $GITHUB_ENV | ||
else | ||
echo "cbf=false" >> $GITHUB_ENV | ||
fi | ||
- name: Commit changes to PR | ||
if: env.cbf == 'true' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Pantheon Robot" | ||
if ! git diff-index --quiet HEAD; then | ||
CHANGES_DETECTED=true | ||
git add *.php | ||
git commit -m "PHPCBF: Fix coding standards" --no-verify | ||
git push origin ${{ github.event.pull_request.head.ref }} || CHANGES_DETECTED=false | ||
echo "changes_detected=$CHANGES_DETECTED" >> $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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters