|
| 1 | +# ============================================================================= |
| 2 | +# Template: Notify Docs Aggregator Workflow |
| 3 | +# ============================================================================= |
| 4 | +# |
| 5 | +# Copy this file to .github/workflows/notify-docs.yml in your source repository |
| 6 | +# (frontmcp, enclave, or vectoriadb). |
| 7 | +# |
| 8 | +# SETUP REQUIRED: |
| 9 | +# 1. Copy this file to your repo's .github/workflows/ directory |
| 10 | +# 2. Update the REPO_NAME env variable to match your repo name |
| 11 | +# 3. Create a repository secret named DOCS_SYNC_TOKEN: |
| 12 | +# - Go to your repo Settings > Secrets and variables > Actions |
| 13 | +# - Create a new secret named DOCS_SYNC_TOKEN |
| 14 | +# - Value: A GitHub PAT with 'repo' scope that has access to agentfront-docs |
| 15 | +# |
| 16 | +# HOW IT WORKS: |
| 17 | +# When you publish a release in your repo, this workflow sends a repository_dispatch |
| 18 | +# event to the agentfront-docs repo, triggering the sync-docs workflow there. |
| 19 | +# |
| 20 | +# ============================================================================= |
| 21 | + |
| 22 | +name: Notify Docs Aggregator |
| 23 | + |
| 24 | +on: |
| 25 | + release: |
| 26 | + types: [published] |
| 27 | + |
| 28 | +env: |
| 29 | + # UPDATE THIS VALUE to match your repository name: |
| 30 | + # - "frontmcp" for agentfront/frontmcp |
| 31 | + # - "enclave" for agentfront/enclave |
| 32 | + # - "vectoriadb" for agentfront/vectoriadb |
| 33 | + REPO_NAME: frontmcp |
| 34 | + |
| 35 | +jobs: |
| 36 | + notify: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Trigger docs sync |
| 40 | + id: dispatch |
| 41 | + uses: actions/github-script@v7 |
| 42 | + with: |
| 43 | + github-token: ${{ secrets.DOCS_SYNC_TOKEN }} |
| 44 | + script: | |
| 45 | + const repoName = process.env.REPO_NAME; |
| 46 | + const tag = context.payload.release.tag_name; |
| 47 | + const sha = context.sha; |
| 48 | +
|
| 49 | + console.log(`Triggering docs sync for ${repoName}`); |
| 50 | + console.log(` Tag: ${tag}`); |
| 51 | + console.log(` SHA: ${sha}`); |
| 52 | +
|
| 53 | + try { |
| 54 | + await github.rest.repos.createDispatchEvent({ |
| 55 | + owner: 'agentfront', |
| 56 | + repo: 'agentfront-docs', |
| 57 | + event_type: 'sync-docs', |
| 58 | + client_payload: { |
| 59 | + repo: repoName, |
| 60 | + sha: sha, |
| 61 | + tag: tag |
| 62 | + } |
| 63 | + }); |
| 64 | + console.log(`Successfully triggered docs sync for ${tag}`); |
| 65 | + return { success: true, tag: tag }; |
| 66 | + } catch (error) { |
| 67 | + console.error(`Failed to trigger docs sync: ${error.message}`); |
| 68 | + if (error.status === 404) { |
| 69 | + console.error('Check that DOCS_SYNC_TOKEN has access to agentfront/agentfront-docs'); |
| 70 | + } else if (error.status === 401) { |
| 71 | + console.error('Check that DOCS_SYNC_TOKEN secret is set correctly'); |
| 72 | + } |
| 73 | + throw error; |
| 74 | + } |
| 75 | +
|
| 76 | + - name: Summary |
| 77 | + run: | |
| 78 | + echo "## Docs Sync Triggered" >> $GITHUB_STEP_SUMMARY |
| 79 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 80 | + echo "- **Repository:** ${{ env.REPO_NAME }}" >> $GITHUB_STEP_SUMMARY |
| 81 | + echo "- **Tag:** ${{ github.event.release.tag_name }}" >> $GITHUB_STEP_SUMMARY |
| 82 | + echo "- **SHA:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY |
| 83 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 84 | + echo "The [agentfront-docs](https://github.com/agentfront/agentfront-docs) repository will sync the documentation shortly." >> $GITHUB_STEP_SUMMARY |
0 commit comments