turbolift
turbolift copied to clipboard
Add build status to pr-status list table
Adding the Build status to the pr-status list command using the StatusCheckRollup
field from the github pr status command.
StatusCheckRollup
contains a list with all the checks for the PR and their statuses, this is an example from a real PR with the pipeline failing:
"statusCheckRollup": [
{
"__typename": "StatusContext",
"context": "continuous-integration/drone/pr",
"startedAt": "2024-03-13T10:11:57Z",
"state": "FAILURE",
"targetUrl": "url"
},
{
"__typename": "CheckRun",
"completedAt": "2024-03-13T09:58:08Z",
"conclusion": "SUCCESS",
"detailsUrl": "url",
"name": "Dependabot config validation",
"startedAt": "2024-03-13T09:58:08Z",
"status": "COMPLETED",
"workflowName": ""
},
{
"__typename": "CheckRun",
"completedAt": "2024-03-13T09:58:05Z",
"conclusion": "SUCCESS",
"detailsUrl": "url",
"name": "Security Rules Check",
"startedAt": "2024-03-13T09:58:05Z",
"status": "COMPLETED",
"workflowName": ""
},
{
"__typename": "StatusContext",
"context": "license/snyk (Skyscanner)",
"startedAt": "2024-03-13T09:58:06Z",
"state": "SUCCESS",
"targetUrl": "url"
},
{
"__typename": "StatusContext",
"context": "security/snyk (Skyscanner)",
"startedAt": "2024-03-13T09:58:06Z",
"state": "SUCCESS",
"targetUrl": "url"
}
],
And this is an example of what the pr-status list would look like now:
Repository State Reviews Build status URL
org/repo1 OPEN REVIEW_REQUIRED FAILURE
org/repo2 MERGED APPROVED SUCCESS
org/repo3 CLOSED FAILURE
State Count
Merged 1
Open 1
Closed 1
Skipped 0
No PR Found 0
Reactions: 👍 4 👎 3 🚀 1