Skip to content

Commit 27df5ff

Browse files
committed
feat: add createCheckRun for Check Runs API
Add createCheckRun() method to post a completed check run with a given conclusion (neutral, success, failure, etc.) using the GitHub Check Runs API, which supports richer conclusions than the legacy Commit Status API.
1 parent 2b81213 commit 27df5ff

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/VCS/Adapter/Git/GitHub.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,28 @@ public function updateCommitStatus(string $repositoryName, string $commitHash, s
872872
$this->call(self::METHOD_POST, $url, ['Authorization' => "Bearer $this->accessToken"], $body);
873873
}
874874

875+
/**
876+
* Creates a completed check run for a commit.
877+
* conclusion can be one of: action_required, cancelled, failure, neutral, success, skipped, stale, timed_out
878+
*/
879+
public function createCheckRun(string $owner, string $repositoryName, string $headSha, string $name, string $conclusion, string $title, string $summary): void
880+
{
881+
$url = "/repos/$owner/$repositoryName/check-runs";
882+
883+
$body = [
884+
'name' => $name,
885+
'head_sha' => $headSha,
886+
'status' => 'completed',
887+
'conclusion' => $conclusion,
888+
'output' => [
889+
'title' => $title,
890+
'summary' => $summary,
891+
],
892+
];
893+
894+
$this->call(self::METHOD_POST, $url, ['Authorization' => "Bearer $this->accessToken"], $body);
895+
}
896+
875897
/**
876898
* Generates a clone command using app access token
877899
*/

0 commit comments

Comments
 (0)