Skip to content

Commit ad1e7e9

Browse files
authored
ci: Update prettier workflow (#309)
Co-authored-by: DenverCoder1 <[email protected]>
1 parent da620d7 commit ad1e7e9

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/workflows/prettier.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@ jobs:
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v3
16+
with:
17+
ref: ${{ github.head_ref }}
18+
19+
- name: Install prettier and plugin-php
20+
run: npm install --global prettier @prettier/plugin-php
1621

1722
- name: Prettify code
18-
uses: creyD/[email protected]
23+
run: composer lint-fix
24+
25+
- name: Commit changes
26+
uses: stefanzweifel/git-auto-commit-action@v4
1927
with:
20-
prettier_options: "--write **/*.{php,md,js,css} !**/*.min.js --print-width 120"
2128
commit_message: "style: Formatted code with Prettier"
22-
prettier_plugins: "@prettier/plugin-php"
29+
branch: ${{ github.head_ref }}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"Composer\\Config::disableProcessTimeout",
3131
"php -S localhost:8000 -t src"
3232
],
33-
"test": "./vendor/bin/phpunit --testdox tests"
33+
"test": "./vendor/bin/phpunit --testdox tests",
34+
"lint": "prettier --check **/*.{php,md,js,css} !**/*.min.js --print-width 120",
35+
"lint-fix": "prettier --write **/*.{php,md,js,css} !**/*.min.js --print-width 120"
3436
}
3537
}

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)