Skip to content

feat: add getCheckRunByName to look up check run ID by commit ref and name#109

Open
HarshMN2345 wants to merge 3 commits into
mainfrom
feat/get-check-run-by-name
Open

feat: add getCheckRunByName to look up check run ID by commit ref and name#109
HarshMN2345 wants to merge 3 commits into
mainfrom
feat/get-check-run-by-name

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Jun 2, 2026

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces getCheckRunByName, a new method that resolves a check-run ID from a commit ref and check name — allowing callers to look up an ID without storing it at creation time. The method is added as a throwing stub on the base Adapter and fully implemented on GitHub.

  • GitHub::getCheckRunByName calls the GitHub check-runs API with the check_name filter, returns 0 on 404 (commit/repo not found), throws on other HTTP errors, and selects the highest ID among returned runs as a proxy for the most recently created one.
  • Five integration tests cover the happy path, a name-mismatch returning 0, a missing repo returning 0, most-recent selection when multiple runs share a name, and a full create → look up → update workflow.

Confidence Score: 5/5

Safe to merge — the new method is a focused, well-tested addition with no changes to existing behavior.

The implementation correctly separates 404 (return 0) from other HTTP errors (throw), uses a straightforward API call with the check_name filter, and is covered by five integration tests exercising all meaningful code paths. No existing logic is modified.

No files require special attention.

Important Files Changed

Filename Overview
src/VCS/Adapter.php Adds the getCheckRunByName abstract stub with a clear doc comment; mirrors the pattern of all other adapter methods.
src/VCS/Adapter/Git/GitHub.php Implements getCheckRunByName using the GitHub check-runs API with proper 404-returns-0 / other-errors-throw error handling and max(array_column(..., 'id')) to select the most recently created run.
tests/VCS/Adapter/GitHubTest.php Five new integration tests covering: basic lookup, name mismatch returns 0, missing repo returns 0, most-recent selection, and end-to-end create-lookup-update workflow.

Reviews (5): Last reviewed commit: "fix: use filter=all + max(id) instead of..." | Re-trigger Greptile

Comment thread tests/VCS/Adapter/GitHubTest.php
@HarshMN2345 HarshMN2345 force-pushed the feat/get-check-run-by-name branch from 1ca158d to 6f9878b Compare June 8, 2026 11:07
@HarshMN2345 HarshMN2345 changed the title feat: add getCheckRunByName to look up check run ID by commit ref and… feat: add getCheckRunByName to look up check run ID by commit ref and name Jun 8, 2026
Comment thread src/VCS/Adapter/Git/GitHub.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant