From 8c00d60e65b227987b9d243bd813f408d91c94e1 Mon Sep 17 00:00:00 2001 From: Matt Holloway Date: Mon, 8 Jun 2026 18:04:42 +0100 Subject: [PATCH] Add release event dispatcher workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an opt-in workflow that fires repository_dispatch on release events to a downstream repository, when one is configured via the RELEASE_AUTOMATION_REPO repository variable. When the variable is unset, the workflow is a no-op so forks and other adopters pay no overhead. Two event types are emitted: mcp-server-release-drafted on release: { types: [created] } mcp-server-released on release: { types: [published] } Prereleases are skipped for both event types. The downstream payload is { tag, url } only — no other release data crosses the boundary. Required when RELEASE_AUTOMATION_REPO is set: Variable RELEASE_AUTOMATION_REPO owner/repo of the downstream Secret RELEASE_AUTOMATION_DISPATCH_PAT PAT with actions:write on it Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/release-dispatch.yml | 71 ++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/release-dispatch.yml diff --git a/.github/workflows/release-dispatch.yml b/.github/workflows/release-dispatch.yml new file mode 100644 index 0000000000..c725412e3e --- /dev/null +++ b/.github/workflows/release-dispatch.yml @@ -0,0 +1,71 @@ +name: Dispatch release events + +# Fires a `repository_dispatch` on release events to an optional downstream +# repository, configured at runtime via the `RELEASE_AUTOMATION_REPO` +# repository variable. When the variable is not set, this workflow is a no-op, +# so adopters and forks pay no overhead unless they opt in. +# +# Event types emitted: +# mcp-server-release-drafted on release: { types: [created] } +# mcp-server-released on release: { types: [published] } +# +# Prereleases are skipped for both event types. +# +# Required when RELEASE_AUTOMATION_REPO is set: +# Variable RELEASE_AUTOMATION_REPO owner/repo of the downstream repo +# Secret RELEASE_AUTOMATION_DISPATCH_PAT PAT with actions:write on that repo + +on: + release: + types: [created, published] + +permissions: {} + +concurrency: + group: release-dispatch-${{ github.event.release.id }}-${{ github.event.action }} + cancel-in-progress: false + +jobs: + dispatch: + if: ${{ vars.RELEASE_AUTOMATION_REPO != '' }} + runs-on: ubuntu-latest + steps: + - name: Resolve event type + id: event + env: + ACTION: ${{ github.event.action }} + IS_PRERELEASE: ${{ github.event.release.prerelease }} + run: | + set -euo pipefail + if [[ "$IS_PRERELEASE" == "true" ]]; then + echo "::notice::Skipping prerelease" + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + case "$ACTION" in + created) echo "type=mcp-server-release-drafted" >> "$GITHUB_OUTPUT" ;; + published) echo "type=mcp-server-released" >> "$GITHUB_OUTPUT" ;; + *) + echo "::notice::Unhandled release action: $ACTION" + echo "skip=true" >> "$GITHUB_OUTPUT" + ;; + esac + + - name: Send repository_dispatch + if: steps.event.outputs.skip != 'true' + env: + GH_TOKEN: ${{ secrets.RELEASE_AUTOMATION_DISPATCH_PAT }} + TARGET_REPO: ${{ vars.RELEASE_AUTOMATION_REPO }} + EVENT_TYPE: ${{ steps.event.outputs.type }} + TAG: ${{ github.event.release.tag_name }} + URL: ${{ github.event.release.html_url }} + run: | + set -euo pipefail + if [[ -z "${GH_TOKEN:-}" ]]; then + echo "::error::RELEASE_AUTOMATION_DISPATCH_PAT secret is not set" + exit 1 + fi + gh api "repos/${TARGET_REPO}/dispatches" \ + -f "event_type=${EVENT_TYPE}" \ + -F "client_payload[tag]=${TAG}" \ + -F "client_payload[url]=${URL}"