Skip to content

refactor(pr): read the readiness checks with gh pr checks #7508

Description

@dan-petty

Problem

Part of #7499. The merge-readiness verdict of devops pr ready, devops pr check-readiness and devops pr monitor reads the check runs and the commit statuses of the head commit through REST (read_commit_checks, src/devops_cli/github/check_verdict.py:440-468), and removes the older runs itself (latest_run_of_each_check, #5383). When the head reports no check, the verdict reads each workflow file at the head and copies the on.pull_request branch and path filters of GitHub (src/devops_cli/github/workflow_triggers.py, GitHubClient.pull_request_workflow_at) to guess whether a check can start (#5144, #5408). devops pr checks falls back to the same REST reads when gh pr checks fails.

Change

  • The verdict reads the checks with gh pr checks <n> --repo <repo> --json name,state,bucket,workflow,link. gh keeps the newest run of each check and each commit status, and gives the bucket.
  • When gh answers no checks reported, the verdict reads the rules of the base branch (GET /repos/{repo}/rules/branches/{base}). Rules that require a check keep the pending check. Rules that require no check mean that there is nothing to wait for: the no-CI advisory, as now.
  • devops pr checks reads gh pr checks --json only. A failed read fails closed.
  • The verdict keeps all checks, not --required. On PR fix(repos): Keep live rules and stricter thresholds #7481, 3 of 29 checks were required. With --required, pr ready would pass a failed Fail-to-Pass Check or CodeQL, which lowers a quality threshold (AGENTS.md rule 5).
  • Delete workflow_triggers.py and its tests, pull_request_workflow_at, read_commit_checks and the REST commit-status read, the REST fallback of fetch_pr_check_verdicts, and the wcmatch dependency.

Done when

  • workflow_triggers.py, pull_request_workflow_at, read_commit_checks and wcmatch are deleted.
  • A test proves that the verdict sends gh pr checks <n> --json ... and maps each bucket, a failed gh read and no checks reported to the verdict.
  • A test proves the no-CI answer for a base branch whose rules require no check, and the wait for rules that require one.
  • The tests of the policy rules stay and pass.

Existing tool considered

GitHub CLI (https://github.com/cli/cli), MIT, v2.106.0 in the devcontainer. pkg/cmd/pr/checks/aggregate.go (eliminateDuplicates) keeps the newest run of each check.

Source

Source: #7499

Activity

  1. added
    type/refactor
    source/agent
    status/new
    value/medium
    effort/medium
    scope/pr
    on Nov 28, 2026
  2. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 28, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  5. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 05:01 UTC

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

    effort/mediumpriority/p2-mediumscope/prsource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions