Skip to content

Commit 1f649f5

Browse files
DevOpsDevOps
authored andcommitted
feat: sync-precommit
1 parent a3e819c commit 1f649f5

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/sync-precommit-config.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,27 @@ jobs:
3030
chmod +x .github/scripts/extract_config.sh
3131
.github/scripts/extract_config.sh
3232
33-
- name: Check if changes exist
33+
- name: Check if any file changed
3434
id: changes
3535
run: |
36-
if git diff --quiet .pre-commit-config.yaml; then
36+
if git diff --quiet; then
3737
echo "changed=false" >> $GITHUB_OUTPUT
3838
else
3939
echo "changed=true" >> $GITHUB_OUTPUT
4040
fi
4141
4242
- name: Commit & push updates
43-
if: steps.changes.outputs.changed == 'true' && github.event_name == 'push'
43+
if: steps.changes.outputs.changed == 'true'
4444
run: |
4545
git config user.name "GitHub Actions"
4646
git config user.email "actions@github.com"
4747
4848
git add .
49-
git commit -m "Sync pre-commit YAML config from global/precommitFile"
49+
50+
if git diff --cached --quiet; then
51+
echo "No staged changes. Skipping commit."
52+
exit 0
53+
fi
54+
55+
git commit -m "Sync pre-commit YAML configs"
5056
git push

0 commit comments

Comments
 (0)