Skip to content

Commit 72092d4

Browse files
authored
Merge pull request #29 from BerryBytes/feat/sync-precommit
Feat/sync precommit
2 parents 186116d + ed5c718 commit 72092d4

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

.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

python/pre-commit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ setup_pre_commit_config() {
6060

6161
cat > "$config" <<'EOF'
6262
repos:
63-
############ ✅ Precommit hooks #############
64-
- repo: https://github.com/pre-commit/pre-commit-hooks
63+
############ ✅ Precommit hooks #############
64+
- repo: https://github.com/pre-commit/pre-commit-hooks
6565
rev: v6.0.0
6666
hooks:
6767
- id: check-yaml

terraform/pre-commit.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ setup_pre_commit_config() {
4646
repos:
4747
############ ✅ Terraform Docs #############
4848
- repo: https://github.com/terraform-docs/terraform-docs
49-
rev: "v0.16.0"
49+
rev: "v0.16.0"
5050
hooks:
5151
- id: terraform-docs-go
52-
args: ["markdown", "table", "--output-file", "README.md", "./"]
53-
- repo: https://github.com/antonbabenko/pre-commit-terraform
52+
args: ["markdown", "table", "--output-file", "README.md", "./"]
53+
- repo: https://github.com/antonbabenko/pre-commit-terraform
5454
rev: "v1.74.1"
5555
hooks:
5656
- id: terraform_fmt

typescript/pre-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ create_config_if_missing() {
6464
#######################################
6565
# Setup pre-commit configuration
6666
#######################################
67-
setup_pre_commit_config() {
67+
setup_pre_commit_config() {
6868
local file=".pre-commit-config.yaml"
6969
log "STEP" "Setting up pre-commit configuration"
7070

0 commit comments

Comments
 (0)