-
Notifications
You must be signed in to change notification settings - Fork 41
207 lines (177 loc) · 7.78 KB
/
Copy pathci.yml
File metadata and controls
207 lines (177 loc) · 7.78 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
name: CI Quality Gates
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [master, main]
jobs:
validate-patterns:
runs-on: ubuntu-latest
name: Validate Documentation Patterns
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '20'
- name: Install dependencies
run: |
cd scripts
npm install
- name: Validate pattern documents
id: validate
run: |
node scripts/validate-patterns.js
env:
CI_MODE: strict
- name: Check terminology consistency
run: |
node scripts/check-terminology.js
env:
CI_MODE: strict
continue-on-error: true
- name: Get changed markdown files
id: changed-files
uses: tj-actions/changed-files@2d756ea4c53f7f6b397767d8723b3a10a9f35bf2 # v44
with:
files: |
**/*.md
- name: Check markdown links (changed files only)
if: steps.changed-files.outputs.any_changed == 'true'
uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1
env:
NODE_OPTIONS: --no-deprecation
with:
use-quiet-mode: 'yes'
config-file: '.github/markdown-link-check-config.json'
check-modified-files-only: 'yes'
continue-on-error: true
- name: Markdown linting
uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16.0.0
with:
globs: |
patterns/*.md
approaches/*.md
use-cases/*.md
vendors/*.md
continue-on-error: true
- name: Summary
if: always()
run: |
echo "## CI Quality Gates Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f validation-report.md ]; then
cat validation-report.md >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ CI checks completed" >> $GITHUB_STEP_SUMMARY
validate-vendors:
runs-on: ubuntu-latest
name: Validate Vendor Documentation
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check content neutrality
run: |
echo "Checking documentation for marketing language..."
# Extended marketing language patterns
MARKETING_WORDS="best|leading|superior|unmatched|revolutionary|cutting-edge|world-class|industry-leading|state-of-the-art|groundbreaking|innovative|seamless|robust|scalable|enterprise-grade|next-generation|unique|only|first|fastest|most secure|unparalleled|comprehensive|end-to-end|one-stop|game-changing|disruptive|bleeding-edge|turnkey|holistic|best-in-class|market-leading|unrivaled|premier|top-tier|ultimate|unprecedented"
FOUND_ISSUES=false
# Check vendors (stricter)
echo "::group::Vendor documentation"
if grep -r -i -E "($MARKETING_WORDS)" vendors/*.md 2>/dev/null | grep -v -f .marketing-exceptions.txt 2>/dev/null || grep -r -i -E "($MARKETING_WORDS)" vendors/*.md 2>/dev/null; then
echo "::warning::Found potential marketing language in vendor documentation"
FOUND_ISSUES=true
fi
echo "::endgroup::"
# Check patterns (warning)
echo "::group::Pattern documentation"
if grep -r -i -E "($MARKETING_WORDS)" patterns/*.md 2>/dev/null | grep -v "_template.md" | grep -v -f .marketing-exceptions.txt 2>/dev/null || grep -r -i -E "($MARKETING_WORDS)" patterns/*.md 2>/dev/null | grep -v "_template.md"; then
echo "::warning::Found potential marketing language in pattern documentation"
FOUND_ISSUES=true
fi
echo "::endgroup::"
# Check approaches (warning)
echo "::group::Approach documentation"
if grep -r -i -E "($MARKETING_WORDS)" approaches/*.md 2>/dev/null | grep -v "_template.md" | grep -v -f .marketing-exceptions.txt 2>/dev/null || grep -r -i -E "($MARKETING_WORDS)" approaches/*.md 2>/dev/null | grep -v "_template.md"; then
echo "::warning::Found potential marketing language in approach documentation"
FOUND_ISSUES=true
fi
echo "::endgroup::"
if [ "$FOUND_ISSUES" = true ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ **Marketing Language Check**" >> $GITHUB_STEP_SUMMARY
echo "Found potential marketing language. Review and use neutral, factual terms." >> $GITHUB_STEP_SUMMARY
fi
- name: Verify vendor cross-references
run: |
echo "Checking vendor pattern references..."
# Ensure vendors reference generic patterns, not vendor-specific ones
for file in vendors/*.md; do
if [ -f "$file" ]; then
if grep -E "pattern-.*-(flashbots|shutter|suave)" "$file" 2>/dev/null; then
echo "::error::Vendor file $file references vendor-specific pattern names"
exit 1
fi
fi
done
prose-lint:
runs-on: ubuntu-latest
name: Prose Quality (Vale)
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Vale linter
uses: errata-ai/vale-action@d89dee975228ae261d22c15adcd03578634d429c # v2
with:
files: |
patterns/
vendors/
approaches/
use-cases/
jurisdictions/
domains/
fail_on_error: false
reporter: github-check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
validate-changelog:
runs-on: ubuntu-latest
name: Validate Changelog
if: github.event_name == 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Check changelog update
run: |
# Get list of changed files in PR
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
# Check if content directories were modified
CONTENT_CHANGED=false
for pattern in "patterns/" "vendors/" "approaches/" "use-cases/" "jurisdictions/" "domains/"; do
if echo "$CHANGED_FILES" | grep -q "^$pattern"; then
CONTENT_CHANGED=true
break
fi
done
# Check if CHANGELOG.md was updated
CHANGELOG_UPDATED=false
if echo "$CHANGED_FILES" | grep -q "^CHANGELOG.md"; then
CHANGELOG_UPDATED=true
fi
# Warn if content changed but changelog wasn't updated
if [ "$CONTENT_CHANGED" = true ] && [ "$CHANGELOG_UPDATED" = false ]; then
echo "::warning::Content files were modified but CHANGELOG.md was not updated."
echo "::warning::Please add an entry to the [Unreleased] section in CHANGELOG.md"
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ **Changelog Reminder**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Content files were modified. Please update CHANGELOG.md:" >> $GITHUB_STEP_SUMMARY
echo "1. Add entry to \`[Unreleased]\` section" >> $GITHUB_STEP_SUMMARY
echo "2. Use format: \`- feat(type): [Name](path) ([#PR](url))\`" >> $GITHUB_STEP_SUMMARY
elif [ "$CHANGELOG_UPDATED" = true ]; then
echo "✅ CHANGELOG.md was updated" >> $GITHUB_STEP_SUMMARY
fi