diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 0000000..3ab68dc --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,49 @@ +name: mirror-skills +on: + push: + branches: [main] + paths: ['skills/**'] + workflow_dispatch: + +concurrency: + group: mirror-skills # serializes racing merges; no cancel-in-progress + +permissions: + contents: read # write to the mirror comes from MIRROR_TOKEN + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: { path: plugins } + - uses: actions/checkout@v4 + with: + repository: agentmail-to/agentmail-skills + token: ${{ secrets.MIRROR_TOKEN }} # fine-grained PAT, contents:write on agentmail-skills only (org disables deploy keys) + path: mirror + - name: Sync skills to mirror root + run: | + rsync -a --delete \ + --exclude '.git' --exclude 'README.md' --exclude 'LICENSE' \ + --exclude 'agents/' \ + plugins/skills/ mirror/ + - name: Recreate agentmail-sdk alias # 3 external lockfiles pin this path + run: | + cp -R mirror/agentmail mirror/agentmail-sdk + sed -i 's/^name: agentmail$/name: agentmail-sdk/' mirror/agentmail-sdk/SKILL.md + - name: Guard pinned skillPaths + run: | + for s in agentmail agentmail-cli agentmail-mcp agentmail-toolkit \ + agentmail-sdk agent-email-patterns email-for-ai-agents; do + test -f "mirror/$s/SKILL.md" || { echo "missing $s/SKILL.md"; exit 1; } + done + - name: Commit and push if changed + working-directory: mirror + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + git diff --cached --quiet && { echo "no changes"; exit 0; } + git commit -m "sync from agentmail-plugins@${GITHUB_SHA}" + git push