-
Notifications
You must be signed in to change notification settings - Fork 0
229 lines (199 loc) · 7.04 KB
/
ci.yml
File metadata and controls
229 lines (199 loc) · 7.04 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
repository-hygiene:
name: Repository hygiene
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Validate required top-level files
shell: bash
run: |
set -euo pipefail
required_files=(
.editorconfig
.gitignore
AGENTS.md
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
README.md
LICENSE
ROADMAP.md
SECURITY.md
)
for file in "${required_files[@]}"; do
test -s "$file"
done
- name: Validate required docs
shell: bash
run: |
set -euo pipefail
required_docs=(
docs/PRD.md
docs/agent-workflow.md
docs/agent-prompts.md
docs/branchbrief.md
docs/cloudflare-pages.md
docs/copilot.md
docs/dependency-policy.md
docs/github-actions.md
docs/llm-policy.md
docs/npm-publishing.md
docs/release-checklist.md
docs/release-process.md
docs/repo-customisation.md
docs/security-policy.md
docs/template-variables.md
)
for doc in "${required_docs[@]}"; do
test -s "$doc"
done
- name: Validate required template directories
shell: bash
run: |
set -euo pipefail
required_template_dirs=(
templates/agents
templates/branchbrief
templates/cloudflare-pages
templates/contributors
templates/dependabot
templates/docs-site
templates/github
templates/github/ISSUE_TEMPLATE
templates/github/workflows
templates/license
templates/npm-package
templates/readme
templates/release
templates/security
)
for dir in "${required_template_dirs[@]}"; do
test -d "$dir"
done
- name: Validate required template files
shell: bash
run: |
set -euo pipefail
required_template_files=(
templates/agents/AGENTS.snippet.md
templates/agents/AGENTS.template.md
templates/branchbrief/README.md
templates/cloudflare-pages/README.md
templates/cloudflare-pages/deploy-docs-cloudflare-pages.yml
templates/cloudflare-pages/wrangler.toml.template
templates/contributors/CODE_OF_CONDUCT.template.md
templates/contributors/CONTRIBUTING.template.md
templates/contributors/REVIEW_PACK.template.md
templates/dependabot/README.md
templates/docs-site/.gitignore
templates/docs-site/README.md
templates/docs-site/astro.config.mjs
templates/docs-site/package.json
templates/docs-site/src/content.config.ts
templates/docs-site/src/content/docs/getting-started.mdx
templates/docs-site/src/content/docs/index.mdx
templates/docs-site/tsconfig.json
templates/github/dependabot.yml
templates/github/pull_request_template.md
templates/github/ISSUE_TEMPLATE/agent_task.md
templates/github/ISSUE_TEMPLATE/bug_report.md
templates/github/ISSUE_TEMPLATE/feature_request.md
templates/github/workflows/branchbrief.yml
templates/github/workflows/ci.yml
templates/github/workflows/docs.yml
templates/license/LICENSE.MIT.template
templates/npm-package/README.md
templates/npm-package/package.json
templates/npm-package/src/index.js
templates/npm-package/test/index.test.js
templates/readme/README.template.md
templates/release/CHANGELOG.template.md
templates/release/ROADMAP.template.md
templates/release/release-checklist.template.md
templates/release/release-process.template.md
templates/security/SECURITY.github-private-reporting.template.md
templates/security/SECURITY.template.md
)
for file in "${required_template_files[@]}"; do
test -s "$file"
done
- name: Validate markdown files are not empty
shell: bash
run: |
set -euo pipefail
markdown_count=0
while IFS= read -r -d '' file; do
markdown_count=$((markdown_count + 1))
test -s "$file"
done < <(find . -type f -name '*.md' -not -path './.git/*' -print0)
if [ "$markdown_count" -eq 0 ]; then
echo "No markdown files found."
exit 1
fi
- name: Validate root docs do not contain unresolved placeholders
shell: bash
run: |
set -euo pipefail
project_facing_root_docs=(
AGENTS.md
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
README.md
ROADMAP.md
SECURITY.md
)
if grep -nE '\{\{[A-Z0-9_][A-Z0-9_]*\}\}' "${project_facing_root_docs[@]}"; then
echo "Unexpected double-brace placeholders found in project-facing root docs."
echo "Reusable placeholders are allowed under templates/ and documented in docs/template-variables.md."
exit 1
fi
- name: Scan generated repository templates for stale repository language
shell: bash
run: |
set -euo pipefail
generated_repository_file_list="$(mktemp)"
trap 'rm -f "$generated_repository_file_list"' EXIT
find templates \
-type f \
\( \
-name '*.md' \
-o -name '*.mdx' \
-o -name '*.json' \
-o -name '*.js' \
-o -name '*.mjs' \
-o -name '*.ts' \
-o -name '*.toml' \
-o -name '*.yml' \
-o -name '*.yaml' \
-o -name '*.template' \
\) \
-not -path 'templates/README.md' \
-not -path 'templates/*/README.md' \
-print |
sort > "$generated_repository_file_list"
if [ ! -s "$generated_repository_file_list" ]; then
echo "No generated repository template files found."
exit 1
fi
stale_pattern='agentic-oss-template|this template repository|Use this template|generated from this template'
stale_matches=0
while IFS= read -r file; do
if grep -nE "$stale_pattern" "$file"; then
stale_matches=1
fi
done < "$generated_repository_file_list"
if [ "$stale_matches" -ne 0 ]; then
echo "Generated repository template files contain stale template repository language."
exit 1
fi