Skip to content

Commit de09a8d

Browse files
DevOpsDevOps
authored andcommitted
feat: sync the updated precommitfiles
1 parent f88b4fc commit de09a8d

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

.github/workflows/releaser.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ jobs:
2626
fetch-depth: 0
2727
fetch-tags: true
2828

29-
# - name: Set up Go
30-
# uses: actions/setup-go@v5
31-
# with:
32-
# go-version: "1.22"
33-
# cache: true
34-
3529
- name: Install GitHub CLI
3630
run: |
3731
sudo apt-get update
@@ -80,10 +74,6 @@ jobs:
8074
echo "skip=false" >> $GITHUB_OUTPUT
8175
fi
8276
83-
# - name: Run Tests
84-
# if: steps.check_commits.outputs.skip != 'true'
85-
# run: go test -cover ./...
86-
8777
- name: Determine new version
8878
if: steps.check_commits.outputs.skip != 'true'
8979
id: new_version

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,58 @@ name: Sync Precommit Config
33
on:
44
push:
55
branches:
6-
- main
7-
paths:
8-
- ".pre-commit-config.yaml"
9-
- "global/pre-commit.sh"
6+
- feat/precommit-config
107
workflow_dispatch:
118

129
permissions:
1310
contents: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
1416

1517
jobs:
1618
sync:
1719
runs-on: ubuntu-latest
1820

1921
steps:
2022
- name: Checkout repository
21-
uses: actions/checkout@v4
23+
uses: actions/checkout@v4
2224
with:
2325
fetch-depth: 0
2426
persist-credentials: true
2527

26-
- name: Ensure target folder exists inside global/
27-
run: mkdir -p global/precommitFile
28+
- name: Extract config from script
29+
run: bash global/extract_config.sh
2830

29-
- name: Copy updated pre-commit config to global/precommitFile
31+
- name: Validate YAML syntax
3032
run: |
31-
cp .pre-commit-config.yaml global/precommitFile/.pre-commit-config.yaml
33+
if command -v yamllint >/dev/null 2>&1; then
34+
yamllint global/precommitFile/.pre-commit-config.yaml
35+
else
36+
python3 -c "import yaml; yaml.safe_load(open('global/precommitFile/.pre-commit-config.yaml'))"
37+
fi
38+
39+
# - name: Copy updated pre-commit config to root
40+
# run: |
41+
# cp global/precommitFile/.pre-commit-config.yaml .pre-commit-config.yaml
3242

3343
- name: Check if changes exist
3444
id: changes
3545
run: |
36-
if git diff --quiet global/precommitFile/.pre-commit-config.yaml; then
46+
if git diff --quiet .pre-commit-config.yaml; then
3747
echo "changed=false" >> $GITHUB_OUTPUT
3848
else
3949
echo "changed=true" >> $GITHUB_OUTPUT
4050
fi
4151
4252
- name: Commit & push updates
43-
if: steps.changes.outputs.changed == 'true'
53+
if: steps.changes.outputs.changed == 'true' && github.event_name == 'push'
4454
run: |
4555
git config user.name "GitHub Actions"
4656
git config user.email "actions@github.com"
47-
48-
git add global/precommitFile/.pre-commit-config.yaml
49-
git commit -m "Sync pre-commit YAML config global/precommitFile"
57+
58+
git add .pre-commit-config.yaml
59+
git commit -m "Sync pre-commit YAML config from global/precommitFile"
5060
git push

0 commit comments

Comments
 (0)