-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (73 loc) · 2.93 KB
/
sync-agent-roles.yml
File metadata and controls
86 lines (73 loc) · 2.93 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
name: Sync agent roles from adcp
# Mirrors `.agents/roles/` + `scripts/import-claude-agents.mjs` from
# the canonical source in adcontextprotocol/adcp. Opens a PR if drift
# is detected. Runs weekly on Mondays and on-demand.
on:
schedule:
- cron: '17 6 * * 1' # Mondays, 06:17 UTC (off-peak)
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22'
- name: Fetch canonical .agents/roles/ and sync script from adcp
run: |
set -euo pipefail
tmp=$(mktemp -d)
curl -fsSL https://github.com/adcontextprotocol/adcp/archive/refs/heads/main.tar.gz \
| tar -xz -C "$tmp" --strip-components=1 \
adcp-main/.agents/roles \
adcp-main/scripts/import-claude-agents.mjs
rm -rf .agents/roles
mkdir -p .agents scripts
cp -r "$tmp/.agents/roles" .agents/roles
cp "$tmp/scripts/import-claude-agents.mjs" scripts/import-claude-agents.mjs
rm -rf "$tmp"
- name: Regenerate .claude/agents/ from synced roles
run: node scripts/import-claude-agents.mjs
- name: Detect drift
id: diff
run: |
if git diff --quiet HEAD; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No drift — nothing to sync."
else
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "Drift detected:"
git diff --stat HEAD
fi
- name: Add empty changeset (repos that use changesets)
if: steps.diff.outputs.changed == 'true' && hashFiles('.changeset/config.json') != ''
run: |
mkdir -p .changeset
cat > .changeset/sync-agent-roles.md <<'EOF'
---
---
Sync `.agents/roles/` from canonical source in `adcontextprotocol/adcp`.
EOF
- uses: peter-evans/create-pull-request@v7
if: steps.diff.outputs.changed == 'true'
with:
branch: claude-routine/sync-agent-roles
base: main
title: 'chore(agents): sync .agents/roles/ from adcp'
commit-message: 'chore(agents): sync .agents/roles/ from adcp'
delete-branch: true
body: |
Automated weekly sync from `adcontextprotocol/adcp:.agents/roles/`
and `scripts/import-claude-agents.mjs`.
Run by `.github/workflows/sync-agent-roles.yml`.
**CI note:** PRs opened by GitHub Actions' default `GITHUB_TOKEN`
don't trigger downstream `pull_request` workflows. The same job
re-ran `node scripts/import-claude-agents.mjs` before opening
this PR, so `.claude/agents/` already matches the synced source.
To force a fresh CI run, close and reopen this PR, or push an
empty commit.