Skip to content

Commit a2b1fe8

Browse files
committed
ci: 新增全量校验 workflow + 补全 lint 缺失目录
- ci.yml: push/PR 时校验所有 agent 文件的 frontmatter 格式和内部链接 - lint-agents.yml: 补充 academic/finance/hr/legal/strategy/supply-chain 目录
1 parent 6942cc5 commit a2b1fe8

2 files changed

Lines changed: 76 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
validate:
11+
name: Validate agent files
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Count agents
17+
run: |
18+
TOTAL=$(find . -path './.github' -prune -o -path './scripts' -prune -o -path './examples' -prune -o -path './integrations' -prune -o -name '*.md' -print | grep -c '/')
19+
echo "Total agent files: $TOTAL"
20+
21+
- name: Check frontmatter format
22+
run: |
23+
ERRORS=0
24+
while IFS= read -r file; do
25+
# Skip non-agent files
26+
case "$file" in
27+
./README*|./CONTRIBUTING*|./UPSTREAM*|./AGENT-LIST*|./CODE_OF_CONDUCT*|./.github/*|./scripts/*|./examples/*|./integrations/*|./docs/*) continue ;;
28+
esac
29+
30+
# Check frontmatter exists
31+
if ! head -1 "$file" | grep -q '^---'; then
32+
echo "::error file=$file::Missing frontmatter (no opening ---)"
33+
ERRORS=$((ERRORS + 1))
34+
continue
35+
fi
36+
37+
# Check required fields
38+
FRONTMATTER=$(sed -n '/^---$/,/^---$/p' "$file" | head -20)
39+
for field in name description; do
40+
if ! echo "$FRONTMATTER" | grep -q "^${field}:"; then
41+
echo "::warning file=$file::Missing recommended field: $field"
42+
fi
43+
done
44+
done < <(find . -path './.github' -prune -o -path './scripts' -prune -o -path './examples' -prune -o -path './integrations' -prune -o -path './node_modules' -prune -o -name '*.md' -print | grep '/')
45+
46+
if [ $ERRORS -gt 0 ]; then
47+
echo "::error::$ERRORS file(s) have frontmatter errors"
48+
exit 1
49+
fi
50+
echo "All agent files validated successfully"
51+
52+
- name: Check for broken internal links
53+
run: |
54+
ERRORS=0
55+
# Check README references to agent files
56+
grep -oP '\[.*?\]\(((?!http)[^)]+\.md)\)' README.md | grep -oP '\(([^)]+)\)' | tr -d '()' | while read -r link; do
57+
if [ ! -f "$link" ]; then
58+
echo "::error file=README.md::Broken link: $link"
59+
ERRORS=$((ERRORS + 1))
60+
fi
61+
done
62+
exit $ERRORS

.github/workflows/lint-agents.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@ name: Lint Agent Files
33
on:
44
pull_request:
55
paths:
6+
- 'academic/**'
67
- 'design/**'
78
- 'engineering/**'
9+
- 'finance/**'
810
- 'game-development/**'
11+
- 'hr/**'
12+
- 'legal/**'
913
- 'marketing/**'
1014
- 'paid-media/**'
11-
- 'sales/**'
1215
- 'product/**'
1316
- 'project-management/**'
14-
- 'testing/**'
15-
- 'support/**'
17+
- 'sales/**'
1618
- 'spatial-computing/**'
1719
- 'specialized/**'
20+
- 'strategy/**'
21+
- 'supply-chain/**'
22+
- 'support/**'
23+
- 'testing/**'
1824

1925
jobs:
2026
lint:
@@ -29,9 +35,11 @@ jobs:
2935
id: changed
3036
run: |
3137
FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- \
32-
'design/**/*.md' 'engineering/**/*.md' 'game-development/**/*.md' 'marketing/**/*.md' 'paid-media/**/*.md' 'sales/**/*.md' 'product/**/*.md' \
33-
'project-management/**/*.md' 'testing/**/*.md' 'support/**/*.md' \
34-
'spatial-computing/**/*.md' 'specialized/**/*.md')
38+
'academic/**/*.md' 'design/**/*.md' 'engineering/**/*.md' 'finance/**/*.md' \
39+
'game-development/**/*.md' 'hr/**/*.md' 'legal/**/*.md' 'marketing/**/*.md' \
40+
'paid-media/**/*.md' 'product/**/*.md' 'project-management/**/*.md' 'sales/**/*.md' \
41+
'spatial-computing/**/*.md' 'specialized/**/*.md' 'strategy/**/*.md' \
42+
'supply-chain/**/*.md' 'support/**/*.md' 'testing/**/*.md')
3543
{
3644
echo "files<<ENDOFLIST"
3745
echo "$FILES"

0 commit comments

Comments
 (0)