-
-
Notifications
You must be signed in to change notification settings - Fork 29
51 lines (42 loc) · 1.4 KB
/
Copy pathdependabot-format.yml
File metadata and controls
51 lines (42 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Dependabot format
on:
pull_request:
branches: [main, master]
# Dependabot-triggered workflows get a read-only token by default;
# elevate so we can push formatting fixes back to the PR branch.
permissions:
contents: write
concurrency:
group: dependabot-format-${{ github.head_ref }}
cancel-in-progress: true
jobs:
format:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# Optional: add a PAT/fine-grained token as FORMAT_BOT_TOKEN so the
# push re-triggers CI (GITHUB_TOKEN commits do not start new runs).
token: ${{ secrets.FORMAT_BOT_TOKEN || secrets.GITHUB_TOKEN }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Format
run: pnpm format:fix
- name: Commit and push if needed
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --staged --quiet; then
echo "No formatting changes"
exit 0
fi
git commit -m "style: apply prettier after dependabot update"
git push