Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hidakatsuya/2780874f80dc57d5dab16ba72fd3950d to your computer and use it in GitHub Desktop.
Save hidakatsuya/2780874f80dc57d5dab16ba72fd3950d to your computer and use it in GitHub Desktop.
Get status of the check-runs for a Git reference

1. Get HEAD reference of main branch

gh api repos/hidakatsuya/shopping_list/branches/main
{
  "name": "main",
  "commit": {
    "sha": "fbc7644c880c0517504e6de6be96e4c3b5c3dda4",
  ...
...

References

2. Get status of the job

gh api repos/hidakatsuya/shopping_list/commits/fbc7644c880c0517504e6de6be96e4c3b5c3dda4/check-runs
{
  "total_count": 1,
  "check_runs": [
    {
      "id": 123,
      "name": "Test",
      (snip)
      "status": "completed",
      "conclusion": "success",
      "started_at": "2022-12-15T11:44:49Z",
      "completed_at": "2022-12-15T11:46:30Z",
  ...
$ gh api repos/hidakatsuya/shopping_list/commits/fbc7644c880c0517504e6de6be96e4c3b5c3dda4/check-runs | jq ".check_runs[0].status"
"completed"

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment