Skip to content

Commit ce317bd

Browse files
DevOpsDevOps
authored andcommitted
feat: sync the updated precommitfiles
1 parent 1485e9d commit ce317bd

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,50 @@
1-
name: Sync Pre-commit Config
1+
name: Sync Precommit Config
22

33
on:
44
push:
55
branches:
66
- main
77
paths:
88
- ".pre-commit-config.yaml"
9-
- "precommitFile/**"
9+
- "global/pre-commit.sh"
1010
workflow_dispatch:
1111

1212
permissions:
1313
contents: write
1414

1515
jobs:
16-
sync-config:
16+
sync:
1717
runs-on: ubuntu-latest
1818

1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
2222
with:
23-
fetch-depth: 0
23+
fetch-depth: 0
24+
persist-credentials: true
2425

25-
- name: Ensure precommitFile directory exists
26-
run: mkdir -p precommitFile
26+
- name: Ensure target folder exists inside global/
27+
run: mkdir -p global/precommitFile
2728

28-
- name: Copy .pre-commit-config.yaml to precommitFile directory
29-
run: cp .pre-commit-config.yaml precommitFile/.pre-commit-config.yaml
29+
- name: Copy updated pre-commit config to global/precommitFile
30+
run: |
31+
cp .pre-commit-config.yaml global/precommitFile/.pre-commit-config.yaml
3032
31-
- name: Check for changes
32-
id: git_status
33+
- name: Check if changes exist
34+
id: changes
3335
run: |
34-
if git diff --quiet; then
36+
if git diff --quiet global/precommitFile/.pre-commit-config.yaml; then
3537
echo "changed=false" >> $GITHUB_OUTPUT
3638
else
3739
echo "changed=true" >> $GITHUB_OUTPUT
3840
fi
3941
40-
- name: Commit and push changes
41-
if: steps.git_status.outputs.changed == 'true'
42+
- name: Commit & push updates
43+
if: steps.changes.outputs.changed == 'true'
4244
run: |
4345
git config user.name "GitHub Actions"
4446
git config user.email "actions@github.com"
45-
46-
git add precommitFile/.pre-commit-config.yaml
47-
git commit -m "Sync .pre-commit-config.yaml to precommitFile directory"
47+
48+
git add global/precommitFile/.pre-commit-config.yaml
49+
git commit -m "Sync pre-commit YAML config → global/precommitFile"
4850
git push

0 commit comments

Comments
 (0)