Skip to content

Commit 2dc6cf2

Browse files
committed
refactor: enabled one general file
1 parent 825f733 commit 2dc6cf2

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.github/workflows/99-auto-fix-dependabot-stylelint-updates.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
---
6-
name: Auto-Format with Stylelint on PR for "self-healing" PRs
6+
name: Auto-Format with Stylelint and Prettier on PR for "self-healing" PRs
77

88
on:
99
workflow_call:
@@ -18,26 +18,28 @@ jobs:
1818
ref: ${{github.event.pull_request.head.ref}}
1919
fetch-depth: 0
2020

21-
- name: Check if Stylelint update PR
21+
- name: Check if Stylelint or Prettier update PR
2222
id: check_pr
2323
run: |
2424
echo "PR title: ${{ github.event.pull_request.title }}"
2525
if [[ "${{ github.event.pull_request.title }}" =~ "bump stylelint from" ]]; then
2626
echo "Stylelint update detected."
2727
echo "stylelint_update=true" >> $GITHUB_ENV
28+
else if [[ "${{ github.event.pull_request.title }}" =~ "bump prettier from" ]]; then
29+
echo "Prettier update detected."
30+
echo "prettier_update=true" >> $GITHUB_ENV
2831
else
29-
echo "No Stylelint update detected."
30-
echo "stylelint_update=false" >> $GITHUB_ENV
32+
echo "No Stylelint or prettier updates detected."
3133
fi
3234
3335
- name: Set up Node.js
34-
if: env.stylelint_update == 'true'
36+
if: env.stylelint_update == 'true' || env.prettier_update == 'true'
3537
uses: actions/setup-node@v4
3638
with:
3739
node-version-file: ".nvmrc"
3840

3941
- name: Install dependencies
40-
if: env.stylelint_update == 'true'
42+
if: env.stylelint_update == 'true' || env.prettier_update == 'true'
4143
run: |
4244
npm ci
4345
@@ -46,13 +48,18 @@ jobs:
4648
run: |
4749
npx --no stylelint "**/*.*css" --fix
4850
51+
- name: Run Prettier to format the code
52+
if: env.prettier_update == 'true'
53+
run: |
54+
npx --no prettier . --write
55+
4956
- name: Commit changes if formatting is done
50-
if: env.stylelint_update == 'true'
57+
if: env.stylelint_update == 'true' || env.prettier_update == 'true'
5158
run: |
5259
git config --global user.name 'github-actions[bot]'
5360
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
5461
echo 'COMMIT_MAIL=github-actions[bot]@users.noreply.github.com' >> .env
5562
5663
git add .
57-
git commit --all -m "refactor(test): auto-format codebase with Stylelint" || echo "No changes to commit"
64+
git commit --all -m "refactor(test): auto-format codebase" || echo "No changes to commit"
5865
git push origin HEAD:${{ github.head_ref }} # Push back to the same PR branch

0 commit comments

Comments
 (0)