Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/sync-precommit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,27 @@ jobs:
chmod +x .github/scripts/extract_config.sh
.github/scripts/extract_config.sh

- name: Check if changes exist
- name: Check if any file changed
id: changes
run: |
if git diff --quiet .pre-commit-config.yaml; then
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' && github.event_name == 'push'
if: steps.changes.outputs.changed == 'true'
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"

git add .
git commit -m "Sync pre-commit YAML config from global/precommitFile"

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
4 changes: 2 additions & 2 deletions python/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ setup_pre_commit_config() {

cat > "$config" <<'EOF'
repos:
############ ✅ Precommit hooks #############
- repo: https://github.com/pre-commit/pre-commit-hooks
############ ✅ Precommit hooks #############
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
Expand Down
6 changes: 3 additions & 3 deletions terraform/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ setup_pre_commit_config() {
repos:
############ ✅ Terraform Docs #############
- repo: https://github.com/terraform-docs/terraform-docs
rev: "v0.16.0"
rev: "v0.16.0"
hooks:
- id: terraform-docs-go
args: ["markdown", "table", "--output-file", "README.md", "./"]
- repo: https://github.com/antonbabenko/pre-commit-terraform
args: ["markdown", "table", "--output-file", "README.md", "./"]
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: "v1.74.1"
hooks:
- id: terraform_fmt
Expand Down
2 changes: 1 addition & 1 deletion typescript/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ create_config_if_missing() {
#######################################
# Setup pre-commit configuration
#######################################
setup_pre_commit_config() {
setup_pre_commit_config() {
local file=".pre-commit-config.yaml"
log "STEP" "Setting up pre-commit configuration"

Expand Down