graphql-hive / graphql-hive/graphql-weekly
Replace GitHub dispatch with Cloudflare Workers Builds
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## 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](https://developers.cloudflare.com/api/resources/workers_builds/subresources/triggers/) 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:
```sh
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`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.