Ad-hoc deployments for Cloudflare Pages projects using GitHub Actions
This codebase allows you to use the "Create deployment" endpoint to arbitrarily deploy existing projects, using GitHub Actions.
Fork this repository and set the following secrets in your project's Secrets page:
CF_API_KEY
: your Global API Key. In the future, you'll be able to set a Pages-specific API token that only has access to your Pages projects, but for now, your Global API Key gives you access to Pages resources.CF_ACCOUNT_ID
: the Cloudflare Account ID that contains your Pages projects.CF_EMAIL
: your Cloudflare email.
Visit the Actions tab on your repository - you may need to manually enable Actions running on your repo fork. Once enabled, go to the "Deploy Pages project" workflow, and manually trigger a deploy in the UI, providing a project name to deploy.
You can automate deployments using this workflow via the repository_dispatch
event. Send an API request to your repo's dispatch endpoint (POST /repos/{owner}/{repo}/dispatches
), specifying a project_name
inside of the client_payload
. For an example cURL request, see examples/repository_dispatch.sh
.