|
| 1 | +# PR Status Dispatch — CONSUMER-REPO TEMPLATE (GSD-101, #706) |
| 2 | +# |
| 3 | +# Copy this file into ANY repo in REPOS.md scope as |
| 4 | +# `.github/workflows/pr-status-dispatch.yaml`. It fires a `repository_dispatch` |
| 5 | +# (event type `pr-status-refresh`) at nsheaps/.org whenever a PR in THIS repo |
| 6 | +# changes state, so .org's PR Status Digest regenerates and picks up the change. |
| 7 | +# |
| 8 | +# Why this exists: .org's pr-status-digest.yaml only sees its OWN pull_request |
| 9 | +# events. When a PR in agents / ai-mktpl / op-exec / … moves open→merged, .org |
| 10 | +# never hears about it and the combined digest goes stale until the 12h cron. |
| 11 | +# This template closes that gap — a state change here pings .org immediately. |
| 12 | +# |
| 13 | +# Requirements (already satisfied for REPOS.md repos via .github/secret-sync.yaml): |
| 14 | +# - secrets.AUTOMATION_GITHUB_APP_ID |
| 15 | +# - secrets.AUTOMATION_GITHUB_APP_PRIVATE_KEY |
| 16 | +# The automation GitHub App must be installed on nsheaps/.org (it is — .org is a |
| 17 | +# secret-sync target), so a token minted here can dispatch to .org. |
| 18 | +# |
| 19 | +# State changes only — explicitly NOT `synchronize` (don't ping on every push). |
| 20 | + |
| 21 | +name: PR Status Dispatch |
| 22 | + |
| 23 | +on: |
| 24 | + pull_request: |
| 25 | + types: [opened, closed, reopened, ready_for_review, converted_to_draft] |
| 26 | + |
| 27 | +# No write perms needed on THIS repo — the dispatch is authorized by the app |
| 28 | +# token scoped to nsheaps/.org, not by GITHUB_TOKEN. |
| 29 | +permissions: {} |
| 30 | + |
| 31 | +concurrency: |
| 32 | + group: pr-status-dispatch-${{ github.event.pull_request.number }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +jobs: |
| 36 | + dispatch: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + # Only dispatch for same-repo PRs — fork PRs can't carry secrets and their |
| 39 | + # state isn't tracked in the digest anyway. |
| 40 | + if: github.event.pull_request.head.repo.full_name == github.repository |
| 41 | + steps: |
| 42 | + - name: Authenticate as GitHub App |
| 43 | + id: app-token |
| 44 | + uses: nsheaps/github-actions/.github/actions/github-app-auth@1e129396b6f0b39257efac9a255010fe64a68ef8 # main |
| 45 | + with: |
| 46 | + app-id: ${{ secrets.AUTOMATION_GITHUB_APP_ID }} |
| 47 | + private-key: ${{ secrets.AUTOMATION_GITHUB_APP_PRIVATE_KEY }} |
| 48 | + owner: nsheaps |
| 49 | + skip-checkout: "true" |
| 50 | + |
| 51 | + - name: Dispatch pr-status-refresh to nsheaps/.org |
| 52 | + uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4 |
| 53 | + with: |
| 54 | + token: ${{ steps.app-token.outputs.token }} |
| 55 | + repository: nsheaps/.org |
| 56 | + event-type: pr-status-refresh |
| 57 | + client-payload: |- |
| 58 | + { |
| 59 | + "source_repo": "${{ github.repository }}", |
| 60 | + "pr_number": ${{ github.event.pull_request.number }}, |
| 61 | + "action": "${{ github.event.action }}" |
| 62 | + } |
0 commit comments