Repository navigation
Conversation
The CI status of a pull request only contained commit statuses, the API Travis used. GitHub Actions report their results as check runs, so they never appeared. getCombinedStatus() now also reads the check runs of the commit, adds them as statuses and combines the state of both. The status was also only refreshed when the pull request itself changed. The new hooks/status route receives the "status" and "check_run" events and updates the CI status of the open pull requests whose head commit changed. An index on project_id and pr_head_sha keeps that lookup cheap. Co-Authored-By: Claude Opus 5.5 <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.
Summary of Changes
The "GitHub merge status" of a pull request (the badge in the issue list and the status list on the item page) had two problems:
GitHubHelper::getCombinedStatus()only read the combined commit status (/commits/{ref}/status), the API that Travis and other external CI services use. GitHub Actions and other GitHub Apps report their results as check runs, which that endpoint doesn't include. For a repository that only uses GitHub Actions, GitHub reports the combined commit status as "pending" forever.pull_requestwebhooks (opened, synchronize, …) and by the CLI sync, so the status shown was the one from the moment the PR was last pushed.Changes:
Statuses::getCheckRuns(): lists the check runs of a ref (latest run per name, up to 100).GitHubHelper::getCombinedStatus(): adds every check run as a status (name as context, job URL as link, output title or conclusion as description) and computes the state from all statuses the way GitHub combines commit statuses:failureif any failed (failure, cancelled, timed out, action required, error), elsependingif any is still queued or running, elsesuccess. Without check runs the combined commit status is used unchanged; if the checks API answers with an error, the commit statuses are shown as before.hooks/status(ReceiveStatusHook) for thestatusandcheck_runevents (actionscreatedandcompleted). It finds the open pull requests of the project whosepr_head_shais the reported commit, fetches the combined status again and storesmerge_stateandgh_merge_status. Payloads for other commits cost one indexed query and no GitHub request.20261111001: index on#__issues (project_id, pr_head_sha)for that lookup, becausecheck_runevents arrive for every CI job.check_runand names the URL.Setup after deploying: add a webhook for the
statusandcheck_runevents to each repository, pointing tohttps://issues.joomla.org/hooks/status(Settings → Webhooks on GitHub, or the tracker's hooks page). Existing pull requests get the new status with their next push, status event orget:projectsync.Fixes #722
Testing Instructions
GitHubHelperCombinedStatusTest: commit statuses only (unchanged behaviour), check runs added as statuses, the combined state for 10 combinations of commit statuses and check runs, and an error of the checks API.ReceiveStatusHookTest: a completed check run and a status event update the open pull requests with that head commit; rerequested/requested-action check runs, payloads without a commit and invalid SHAs are ignored; an unknown commit doesn't call GitHub.phpunit, PHPStan (as configured in CI) and php-cs-fixer pass.Documentation Changes Required
The webhook setup above (new
hooks/statusURL for thestatusandcheck_runevents).🤖 Generated with Claude Code