|
| 1 | +# Copy this workflow into edictum and edictum-console repositories: |
| 2 | +# .github/workflows/notify-docs.yml |
| 3 | +# |
| 4 | +# Fires a repository_dispatch event to edictum-docs whenever a PR |
| 5 | +# is merged to main. Skips dependabot PRs and PRs labeled 'no-docs'. |
| 6 | +# |
| 7 | +# Uses the edictum-reviewer GitHub App for cross-repo authentication. |
| 8 | +# The app needs 'contents: write' permission for repository_dispatch. |
| 9 | +# |
| 10 | +# Required secrets/variables (org-level): |
| 11 | +# APP_ID — GitHub App ID (secret) |
| 12 | +# APP_PRIVATE_KEY — GitHub App private key (secret) |
| 13 | +# |
| 14 | +# Setup: |
| 15 | +# 1. Ensure APP_ID, APP_PRIVATE_KEY, and ANTHROPIC_API_KEY are org secrets |
| 16 | +# 2. Copy this file to .github/workflows/notify-docs.yml in both: |
| 17 | +# - edictum-ai/edictum |
| 18 | +# - edictum-ai/edictum-console |
| 19 | + |
| 20 | +name: Notify Docs |
| 21 | + |
| 22 | +on: |
| 23 | + pull_request: |
| 24 | + types: [closed] |
| 25 | + branches: [main] |
| 26 | + |
| 27 | +permissions: {} |
| 28 | + |
| 29 | +jobs: |
| 30 | + notify: |
| 31 | + name: Notify edictum-docs |
| 32 | + if: | |
| 33 | + github.event.pull_request.merged == true && |
| 34 | + !contains(github.event.pull_request.labels.*.name, 'no-docs') && |
| 35 | + github.actor != 'dependabot[bot]' && |
| 36 | + github.actor != 'renovate[bot]' |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Generate app token |
| 40 | + id: app-token |
| 41 | + uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1 |
| 42 | + with: |
| 43 | + app-id: ${{ secrets.APP_ID }} |
| 44 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 45 | + owner: edictum-ai |
| 46 | + repositories: edictum-docs |
| 47 | + |
| 48 | + - name: Dispatch to edictum-docs |
| 49 | + env: |
| 50 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 51 | + REPO: ${{ github.repository }} |
| 52 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 53 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 54 | + PR_AUTHOR: ${{ github.event.pull_request.user.login }} |
| 55 | + run: | |
| 56 | + gh api repos/edictum-ai/edictum-docs/dispatches \ |
| 57 | + --method POST \ |
| 58 | + -f event_type=source-pr-merged \ |
| 59 | + -f "client_payload[repo]=${REPO}" \ |
| 60 | + -f "client_payload[pr_number]=${PR_NUMBER}" \ |
| 61 | + -f "client_payload[pr_url]=${PR_URL}" \ |
| 62 | + -f "client_payload[pr_author]=${PR_AUTHOR}" |
0 commit comments