Skip to content

Commit 9005293

Browse files
committed
ci: add CI workflow for validating shell scripts and YAML templates
1 parent 7751331 commit 9005293

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
validate:
10+
name: Validate shell scripts
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Check hook syntax
17+
run: bash -n hook/pre-push
18+
19+
- name: Check installer syntax
20+
run: bash -n install.sh
21+
22+
- name: Verify hook is executable
23+
run: |
24+
if [ ! -x hook/pre-push ]; then
25+
echo "hook/pre-push is not executable. Run: chmod +x hook/pre-push"
26+
exit 1
27+
fi
28+
29+
- name: Verify install.sh is executable
30+
run: |
31+
if [ ! -x install.sh ]; then
32+
echo "install.sh is not executable. Run: chmod +x install.sh"
33+
exit 1
34+
fi
35+
36+
- name: Ensure release-please files were not manually modified
37+
run: |
38+
release_please_files="VERSION CHANGELOG.md .release-please-manifest.json release-please-config.json"
39+
touched=""
40+
for f in $release_please_files; do
41+
if git diff --name-only origin/main...HEAD | grep -qF "$f"; then
42+
touched="$touched $f"
43+
fi
44+
done
45+
if [ -n "$touched" ]; then
46+
echo "The following files are managed by release-please and must not be edited manually:"
47+
for f in $touched; do
48+
echo " •$f"
49+
done
50+
echo ""
51+
echo "Version bumps and changelog updates are handled automatically when a"
52+
echo "release-please PR is merged. Do not edit these files directly."
53+
exit 1
54+
fi
55+
echo "No release-please files were manually modified ✓"
56+
57+
- name: Verify all templates are valid YAML
58+
run: |
59+
for f in templates/*.yml; do
60+
echo "Checking $f..."
61+
python3 -c "import sys, yaml; yaml.safe_load(open('$f'))" \
62+
&& echo " $f ✓" \
63+
|| { echo " $f is invalid YAML"; exit 1; }
64+
done
65+
66+
- name: Verify templates contain required keys
67+
run: |
68+
required_keys="agent review tools ignore_paths"
69+
for f in templates/*.yml; do
70+
for key in $required_keys; do
71+
if ! grep -q "^${key}:" "$f"; then
72+
echo "$f is missing required top-level key: $key"
73+
exit 1
74+
fi
75+
done
76+
echo "$f ✓"
77+
done

0 commit comments

Comments
 (0)