Skip to content

Replace GitHub dispatch with Cloudflare Workers Builds #19

@hasparus

Description

@hasparus

Problem

Publishing an issue from the CMS should trigger a web rebuild+deploy. The current approach uses GitHub repository_dispatch to push an empty commit to main, which:

  • Gets blocked by branch protection rules (PRs required)
  • Requires a GitHub PAT with org approval
  • Adds unnecessary indirection through GitHub Actions

Solution

Use Cloudflare Workers Builds API to trigger the web rebuild directly from the API worker.

POST /accounts/{account_id}/builds/triggers/{trigger_uuid}/builds

Steps

Manual (Cloudflare dashboard)

  1. Enable Workers Builds for graphqlweekly-v2 (Settings > Builds > Connect to Git)
  2. Note the trigger UUID
  3. Create a Cloudflare API token with Workers Builds permissions
  4. Set secrets on the API worker:
    wrangler secret put CLOUDFLARE_BUILDS_API_TOKEN
    wrangler secret put CLOUDFLARE_BUILDS_TRIGGER_ID

Code changes

  1. Replace triggerDeploy in packages/api/src/resolvers/index.ts — call Cloudflare builds API instead of GitHub dispatch
  2. Replace GITHUB_TOKEN with CLOUDFLARE_BUILDS_API_TOKEN + CLOUDFLARE_BUILDS_TRIGGER_ID in Env type
  3. Remove GITHUB_TOKEN secret from the worker (wrangler secret delete GITHUB_TOKEN)
  4. Delete .github/workflows/publish.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions