feat(repository_hub): report build status via GitHub Checks API for App repos#1049
Draft
skipi wants to merge 1 commit into
Draft
feat(repository_hub): report build status via GitHub Checks API for App repos#1049skipi wants to merge 1 commit into
skipi wants to merge 1 commit into
Conversation
…pp repos Behind the `:github_checks_api` org feature flag, `github_app`-integrated repositories now report CI status as native GitHub check-runs instead of legacy commit statuses. Check-runs are upserted per `(commit_sha, name)` — created on the pending event, updated on completion — which removes the legacy 1000-statuses-per-`(sha, context)` cap and keeps a single mutable status object per context. `github_oauth_token` repositories and flag-off App repos keep the Commit Status API: check-runs can only be created with a GitHub App installation token (OAuth tokens 403). The check-run name equals the existing status context string, so branch-protection "required status checks" keep matching with no customer action. - New `RepositoryHub.GithubChecksClient` (Tesla): create/update/find check-run; find returns the latest run by id (GitHub's list order is not guaranteed). - `repository_hub` gains the `feature_provider` dep + provider; the status-vs-check choice is made entirely in `create_build_status_action` — no proto or github_notifier change. A check-run write failure fails the request; the flag is the revert. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a path to report CI build status to GitHub via the Checks API (check-runs) for GitHub App-connected repositories, behind the
:github_checks_apiorg feature flag. OAuth-connected repos and flag-off App repos keep the legacy Commit Status API.Why
The Commit Status API is append-only — every update creates a new status object, and GitHub caps a commit at 1000 statuses per
(sha, context). High-block pipelines hit that ceiling. Check-runs are a single mutable object per(sha, name), updated through its lifecycle — removing the cap and unlocking richer PR UX (annotations, re-run actions) as future work.How
RepositoryHub.GithubChecksClient(Tesla) —create_check_run/update_check_run/find_check_run;findreturns the latest run byid(GitHub's list order is not guaranteed).create_build_status_action(GitHub adapter) chooses the path:github_app+ flag on → check-run upsert by(commit_sha, name); otherwise the legacy commit status. The decision is local torepository_hub— no proto and nogithub_notifierchange.repository_hubgains thefeature_providerdependency + provider module, plus a test-env YAML provider so the existing suite makes no network calls.ci/semaphoreci/{push|pr|tag}: {name}), so branch-protection "required status checks" keep matching with no user action.Lifecycle (upsert)
PENDING→ update the latest open run, or createin_progress(never re-opens acompletedrun, so a rebuild starts a fresh run).SUCCESS/FAILURE/STOPPED→ update the latest run tocompletedwith conclusionsuccess/failure/cancelled, or create it.Constraints / rollout
github_oauth_tokenrepos therefore remain on commit statuses.:github_checks_apifeature to be registered and enabled per org before any behavior changes — merging alone changes nothing.Testing
mix test— 17 examples, 0 failures (--warnings-as-errors, OTP 25):github_checks_client_test.exs— create / update / find, including latest-by-id among several same-named runs.create_build_status_action_test.exs— flag on/off, PENDING/SUCCESS, existing-in_progress reuse, completed-run rebuild → fresh run, find-miss fallback, error propagation, plus OAuth and App parity.Draft: paused pending review and per-org flag rollout planning.
🤖 Generated with Claude Code