forked from coder/ai.coder.com
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.6 KB
/
pre-commit-hooks.yml
File metadata and controls
56 lines (49 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Optional: Pre-commit hooks workflow
# This provides guidance for setting up local pre-commit hooks
name: Pre-commit Validation
on:
pull_request:
paths:
- ".pre-commit-config.yaml"
- ".github/workflows/pre-commit-hooks.yml"
jobs:
validate-pre-commit:
name: Validate Pre-commit Configuration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install pre-commit
run: |
pip install pre-commit
pre-commit --version
- name: Run pre-commit on all files
run: pre-commit run --all-files
continue-on-error: true
- name: Show pre-commit setup instructions
if: always()
run: |
echo "## 📋 Setting up Pre-commit Hooks Locally"
echo ""
echo "Pre-commit hooks help catch secrets BEFORE they reach GitHub."
echo ""
echo "### Installation:"
echo "\`\`\`bash"
echo "# Install pre-commit"
echo "pip install pre-commit"
echo ""
echo "# Install the git hooks"
echo "pre-commit install"
echo ""
echo "# (Optional) Run against all files"
echo "pre-commit run --all-files"
echo "\`\`\`"
echo ""
echo "### What it does:"
echo "- Scans for secrets before each commit"
echo "- Validates Terraform formatting"
echo "- Checks for merge conflicts"
echo "- Prevents large files from being committed"