|
1 | | -name: Lint and Validate |
| 1 | +name: Validate |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [main, develop] |
| 5 | + branches: [main] |
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
8 | | - workflow_dispatch: |
9 | 8 |
|
10 | 9 | jobs: |
11 | | - shellcheck: |
12 | | - name: Shell Script Linting |
| 10 | + validate: |
| 11 | + name: Validate Structure |
13 | 12 | runs-on: ubuntu-latest |
14 | 13 | steps: |
15 | 14 | - uses: actions/checkout@v4 |
16 | | - |
17 | | - - name: Run ShellCheck |
18 | | - uses: ludeeus/action-shellcheck@master |
19 | | - with: |
20 | | - scandir: 'scripts' |
21 | | - format: gcc |
22 | | - severity: error |
23 | 15 |
|
24 | | - yaml-lint: |
25 | | - name: YAML Linting |
26 | | - runs-on: ubuntu-latest |
27 | | - steps: |
28 | | - - uses: actions/checkout@v4 |
29 | | - |
30 | | - - name: Run yamllint |
31 | | - uses: karancode/yamllint-github-action@v2.3.1 |
32 | | - with: |
33 | | - yamllint_file_or_dir: '.' |
34 | | - yamllint_strict: false |
35 | | - yamllint_comment: true |
36 | | - |
37 | | - markdown-lint: |
38 | | - name: Markdown Linting |
39 | | - runs-on: ubuntu-latest |
40 | | - steps: |
41 | | - - uses: actions/checkout@v4 |
42 | | - |
43 | | - - name: Run markdownlint |
44 | | - uses: DavidAnson/markdownlint@v3 |
45 | | - with: |
46 | | - globs: | |
47 | | - **/*.md |
48 | | - !node_modules/** |
| 16 | + - name: Check required files |
| 17 | + run: | |
| 18 | + for f in README.md LICENSE .gitignore; do |
| 19 | + test -f "$f" || { echo "Missing $f"; exit 1; } |
| 20 | + done |
| 21 | + echo "All required files present" |
49 | 22 |
|
50 | | - json-validate: |
51 | | - name: JSON Validation |
52 | | - runs-on: ubuntu-latest |
53 | | - steps: |
54 | | - - uses: actions/checkout@v4 |
55 | | - |
56 | 23 | - name: Validate JSON files |
57 | 24 | run: | |
58 | 25 | find . -name "*.json" -not -path "./.git/*" | while read -r file; do |
59 | 26 | echo "Validating $file" |
60 | 27 | python3 -m json.tool "$file" > /dev/null || exit 1 |
61 | 28 | done |
| 29 | + echo "All JSON files valid" |
62 | 30 |
|
63 | | - file-structure: |
64 | | - name: Validate File Structure |
65 | | - runs-on: ubuntu-latest |
66 | | - steps: |
67 | | - - uses: actions/checkout@v4 |
68 | | - |
69 | | - - name: Check required files exist |
| 31 | + - name: Check scripts are executable |
70 | 32 | run: | |
71 | | - required_files=( |
72 | | - "README.md" |
73 | | - "LICENSE" |
74 | | - ".gitignore" |
75 | | - "templates/terraform/CLAUDE.md" |
76 | | - "templates/kubernetes/CLAUDE.md" |
77 | | - "templates/python/CLAUDE.md" |
78 | | - "templates/cicd/CLAUDE.md" |
79 | | - "prompts/iac-generation.md" |
80 | | - "prompts/debugging.md" |
81 | | - "prompts/migration.md" |
82 | | - "prompts/security-review.md" |
83 | | - "scripts/setup-claude-project.sh" |
84 | | - "scripts/bulk-review.sh" |
85 | | - "scripts/generate-docs.sh" |
86 | | - ) |
87 | | - |
88 | | - missing_files=() |
89 | | - for file in "${required_files[@]}"; do |
90 | | - if [[ ! -f "$file" ]]; then |
91 | | - missing_files+=("$file") |
92 | | - fi |
| 33 | + for f in scripts/*.sh; do |
| 34 | + test -x "$f" || { echo "$f is not executable"; exit 1; } |
93 | 35 | done |
94 | | - |
95 | | - if [[ ${#missing_files[@]} -gt 0 ]]; then |
96 | | - echo "Missing required files:" |
97 | | - printf ' - %s\n' "${missing_files[@]}" |
98 | | - exit 1 |
99 | | - fi |
100 | | - |
101 | | - echo "All required files present" |
| 36 | + echo "All scripts executable" |
102 | 37 |
|
103 | | - scripts-executable: |
104 | | - name: Check Scripts are Executable |
| 38 | + shellcheck: |
| 39 | + name: ShellCheck |
105 | 40 | runs-on: ubuntu-latest |
106 | 41 | steps: |
107 | 42 | - uses: actions/checkout@v4 |
108 | | - |
109 | | - - name: Check script permissions |
| 43 | + - name: Run ShellCheck |
110 | 44 | run: | |
111 | | - scripts=( |
112 | | - "scripts/setup-claude-project.sh" |
113 | | - "scripts/bulk-review.sh" |
114 | | - "scripts/generate-docs.sh" |
115 | | - ) |
116 | | - |
117 | | - for script in "${scripts[@]}"; do |
118 | | - if [[ ! -x "$script" ]]; then |
119 | | - echo "Script $script is not executable" |
120 | | - exit 1 |
121 | | - fi |
| 45 | + for f in scripts/*.sh; do |
| 46 | + echo "Checking $f" |
| 47 | + shellcheck -S error "$f" || exit 1 |
122 | 48 | done |
123 | | - |
124 | | - echo "All scripts are executable" |
0 commit comments