-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.73 KB
/
Copy pathprettier.yml
File metadata and controls
57 lines (49 loc) · 1.73 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
52
53
54
55
56
57
name: Code formatting
on:
schedule:
- cron: '15 4 2 * *' # At 04:05 on day-of-month 2.
workflow_dispatch:
jobs:
formatting:
name: Code formatting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: ".node-version"
- name: Run make clean
run: make clean
- name: Run make init
run: make init
- name: Run make prettier
run: make prettier
# Commit results back to repository
- name: Commit changes
id: auto-commit
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: Code formatting via `make prettier`
branch: main
commit_user_name: Code formatting workflow bot
commit_user_email: bot@sourcectl.dev
commit_author: Code formatting workflow bot <bot@sourcectl.dev>
skip_push: true
- name: Push changes with retry
if: steps.auto-commit.outputs.changes_detected == 'true'
run: |
max_retries=3
for attempt in $(seq 1 $max_retries); do
echo "Push attempt $attempt of $max_retries"
if git push origin main; then
echo "Push succeeded on attempt $attempt"
exit 0
fi
echo "Push failed, pulling with rebase and retrying..."
git pull --rebase origin main
sleep $((attempt * 2))
done
echo "Push failed after $max_retries attempts"
exit 1