-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (45 loc) · 1.23 KB
/
sync-precommit-config.yaml
File metadata and controls
56 lines (45 loc) · 1.23 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
name: Sync Precommit Config
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
- name: Extract config from script
run: |
chmod +x .github/scripts/extract_config.sh
.github/scripts/extract_config.sh
- name: Check if any file changed
id: changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit & push updates
if: steps.changes.outputs.changed == 'true'
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
if git diff --cached --quiet; then
echo "No staged changes. Skipping commit."
exit 0
fi
git commit -m "Sync pre-commit YAML configs"
git push