Cloudflare Pages GitHub integration sets head_branch to wrong value

Link a Cloudflare Pages project to a GitHub repo and configure the Cloudflare Pages “builds & deployments” so that pushing to a “main” branch triggers a deploy. When a commit is pushed (via git push, not via the UI) to the main branch, Cloudflare dutifully deploys and updates the status of the commit with a GitHub CheckSuite.

Within the GitHub CheckSuite, the head_branch is set to the feature branch name.

  "action": "completed",
  "check_suite": {
    "id": 1146905444,
    "head_branch": "some-branch",

In contrast, GitHub Action runs for the commit also produce CheckSuite events, but they set the head_branch to “main” in this situation.

Why does this matter? If you’re integrating with GitHub Webhooks, you probably want to do something in response to check suites on “main”. But Cloudflare Pages builds will always produce CheckSuite events with some other branch listed. Push a change to a feature branch and then to main and you’ll receive identical CheckSuite events, meaning there is no way to tell whether Cloudflare deployed from main.

I suspect the Cloudflare Pages GitHub app is re-using / updating an existing CheckSuite, when it should be creating a new one.