-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (70 loc) · 2.47 KB
/
docs-sync.yml
File metadata and controls
82 lines (70 loc) · 2.47 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
name: Docs Sync
on:
push:
paths:
- "docs/**"
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Identify changed docs
id: changed
run: |
FILES=$(git diff --name-only --diff-filter=AM HEAD~1 HEAD -- 'docs/*.md' | tr '\n' ' ')
echo "files=$FILES" >> "$GITHUB_OUTPUT"
if [ -z "$FILES" ]; then
echo "No doc files changed."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "Changed files: $FILES"
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Run Claude Code frontmatter update
id: claude
if: steps.changed.outputs.skip == 'false'
continue-on-error: true
run: |
claude \
--task-file .github/agents/frontmatter-prompt.md \
--allowedTools "Edit,Read" \
--no-interactive \
--output-format json
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
CHANGED_FILES: ${{ steps.changed.outputs.files }}
- name: Check Claude Code result
if: steps.claude.outcome == 'failure'
run: |
echo "::warning::Claude Code frontmatter update failed. Continuing with index regeneration."
- name: Set up Python
if: steps.changed.outputs.skip == 'false'
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
if: steps.changed.outputs.skip == 'false'
run: pip install -r requirements.txt
- name: Regenerate AGENTS.md index
if: steps.changed.outputs.skip == 'false'
run: python scripts/agents/build-index.py
- name: Create pull request
if: steps.changed.outputs.skip == 'false'
uses: peter-evans/create-pull-request@v6
with:
title: "[agents] sync frontmatter and index"
body: |
Automated sync triggered by changes to docs/.
**Changed files:** ${{ steps.changed.outputs.files }}
Review the generated `description` fields to verify they are accurate trigger conditions.
branch: agents/sync-${{ github.sha }}
base: ${{ github.ref_name }}
labels: agents-sync
commit-message: "chore: sync frontmatter and regenerate AGENTS.md index"