Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 3

State is pending, statuses are missing with GitHub API v3

For example:

 

There are 4 "success" statuses on this commit:

https://github.com/knocte/geewallet/commit/06fcd4f3db45a9679c4713ec3afc05550ab5f980

 

The API shows none, and gives a "pending" state:

https://api.github.com/repos/knocte/geewallet/commits/06fcd4f3db45a9679c4713ec3afc05550ab5f980/statu...

 

It could be related to GitHub Actions; I saw this in one of my repos and I was also using GitHub Actions.

2 Replies
Highlighted
Copilot Lvl 3
Message 2 of 3

Re: State is pending, statuses are missing with GitHub API v3

Copilot Lvl 3
Message 3 of 3

Re: State is pending, statuses are missing with GitHub API v3

We have experienced the same issue for GitHub Actions and reached out to GitHub about this. The suggestion they gave to us was to use the suites API (https://developer.github.com/v3/checks/suites/) instead of statuses

 

Other CI tools such as CircleCI and Jenkins rely on statuses but not GitHub Actions it seems. You can create your own status by pushing to the statuses API itself if necessary (bit of a hack though)

 

The example repository I showed them was here:

https://github.com/cfarrend/github-status-checks

 

From GitHub Support:

Rather than using the endpoint for listing statuses for a specific ref:

https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref

We suggest using this endpoint for listing the check suites for a specific ref, since GitHub Actions creates check suites and check runs to reflect those job statuses (and not commit statuses):

https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref

Here's an example using curl (https://curl.haxx.se) for fetching a list of check suites for the first commit, b147efab0447fe54c7ea567508ccfabb555816f4:

curl -H "Accept: application/vnd.github.antiope-preview+json" "https://api.github.com/repos/cfarrend/github-status-checks/commits/b147efab0447fe54c7ea567508ccfabb5..."

{
  "total_count": 1,
  "check_suites": [
    {
      "id": 427688498,
      "node_id": "MDEwOkNoZWNrU3VpdGU0Mjc2ODg0OTg=",
      "head_branch": "master",
      "head_sha": "b147efab0447fe54c7ea567508ccfabb555816f4",
      "status": "completed",
      "conclusion": "failure",
# ...

There's also an endpoint for fetching a list of check runs for a specific ref:

https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref

Here's another example curl request:

curl -H "Accept: application/vnd.github.antiope-preview+json" "https://api.github.com/repos/cfarrend/github-status-checks/commits/b147efab0447fe54c7ea567508ccfabb5..."

{
  "total_count": 1,
  "check_runs": [
    {
      "id": 416127022,
      "node_id": "MDg6Q2hlY2tSdW40MTYxMjcwMjI=",
      "head_sha": "b147efab0447fe54c7ea567508ccfabb555816f4",
      "external_id": "32a2d69e-f5dc-5f4d-8687-38738de577cd",
      "url": "https://api.github.com/repos/cfarrend/github-status-checks/check-runs/416127022",
      "html_url": "https://github.com/cfarrend/github-status-checks/runs/416127022",
      "details_url": "https://help.github.com/en/actions",
      "status": "completed",
      "conclusion": "failure",
# ...