OutputValues icon
Request icon
Get icon
Switch icon
Set icon
Comment icon
Pause icon
If icon
Loop icon
Log icon
Webhook icon

Repair GitHub Required Status Checks That No Workflow Reports Anymore

Find required GitHub checks that no job reports anymore, approve the replacement in Kestra and update branch protection and rulesets.

Categories
Infrastructure

Branch protection and rulesets require checks by name. Rename a CI job, turn it into a matrix or drop it, and every pull request waits for a check that never arrives ("Expected - Waiting for status to be reported") until an admin edits the settings by hand. This flow finds the stale check and fixes the settings once a person approves.

How it works

  1. A GitHub webhook sends every workflow_run event to Kestra, and the flow starts when a pull_request run completes.
  2. For that run's commit, the flow reads the open pull request, the required checks from branch protection and rulesets, and every check and status reported.
  3. If checks are still running, the next completed run checks again. Otherwise, a required check that wasn't reported is stale.
  4. It comments on the pull request, then a Pause asks which of the checks that ran to require instead.
  5. On approval it updates branch protection and each ruleset, keeping the GitHub App each check comes from, reads the settings back and comments with the result.

What you get

  • A comment on the blocked pull request naming the stale check and what ran instead.
  • Both classic branch protection and rulesets handled, including matrix jobs that report test (3.12) instead of test.
  • Nothing changes without approval, and a declined fix isn't asked again for 30 days.

Who it's for

Platform teams who own branch protection, and maintainers whose pull requests stall after a CI change.

Why orchestrate this with Kestra

  • The approval pauses the execution for as long as needed, and its choices are validated against what GitHub reported.
  • The Webhook trigger reacts to each finished run, and the KV Store remembers what was already asked.

Prerequisites

  • A repository whose branch requires status checks in branch protection, a ruleset or both.
  • A Kestra URL that GitHub can reach, for the webhook.

Secrets

  • GITHUB_TOKEN: classic token with the repo scope from a repository admin, since editing branch protection and rulesets needs admin rights.
  • GITHUB_WEBHOOK_KEY: a random string that ends the webhook URL.

Quick start

  1. Add the GITHUB_TOKEN and GITHUB_WEBHOOK_KEY secrets to the namespace.
  2. Set repository and branch in variables and save the flow.
  3. In the repository's Settings > Webhooks, add https://<your-kestra>/api/v1/main/executions/webhook/company.engineering/github-stale-required-checks-repair/<key> with content type application/json and only the "Workflow runs" event.
  4. A stale check then shows up as a comment and a paused execution to resume.

How to extend

  • Post the approval request to Slack with a link to the execution.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.