Skip to content

Re-running the DCO check run does nothing #305

Closed

Description

@tykeal

Problem

The app registers a handler for check_run.rerequested:

app.on(
  [
    "pull_request.opened",
    "pull_request.synchronize",
    "check_run.rerequested",
  ],
  check
);

async function check(
  context,
  pr = context.payload.pull_request,
  ...
) {
  const sha = reportSha || pr.head.sha;

check_run webhook payloads do not contain a top-level pull_request property. From GitHub's own OpenAPI description of check-run-rerequested, the payload's top-level properties are:

action, check_run, installation, enterprise, organization, repository, sender

Pull requests are exposed at check_run.pull_requests[], whose items carry only id, number, url, head, base.

So pr is undefined and pr.head.sha throws a TypeError immediately. Clicking "Re-run" on the DCO check has never done anything. The exception escapes before any check run is created, so nothing is reported and the existing result simply stays as it was.

Why it went unnoticed

There is no check_run.rerequested fixture in test/fixtures/ and no test for it anywhere in the suite. The repository enforces 100% coverage, but the handler shares its body with the pull_request.* handlers, so the check() function is fully covered through those events and the broken registration never shows up as a coverage gap. Only the event-name string is uncovered, and a string literal in an array is not a branch.

Note that check_run.requested_action (the "Set DCO to pass" button) is a separate handler that correctly reads context.payload.check_run, and it does work. Only the re-run path is broken.

Impact

This is the natural recovery path for a DCO check that is wrong or stuck, and it is what maintainers reach for first. It is also the remediation the app should be able to suggest when something goes wrong internally — see #302, where an unreported check leaves a required status pending indefinitely.

Fix

Give check_run.rerequested its own handler that resolves a real pull request before delegating to check():

  • Read context.payload.check_run.pull_requests.
  • The entries are minimal and lack fields check() needs (notably html_url, which is passed to getDCOStatus), so fetch the full PR with pulls.get using the entry's number.
  • Be aware that check_run.pull_requests can be empty — for example for check runs not associated with a pull request. That case needs defined behaviour rather than a crash.

Tests should use a realistic check_run.rerequested fixture rather than a hand-built object, so this class of mismatch cannot recur.

Activity

  1. added a commit that references this issue on Jul 28, 2026
    d9ca2d8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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