Closed algomaster99 closed 2 years ago
@algomaster99 could you please share how you fixed that issue?
Hi @mherger !
I did something like this:
if(${{ github.event.inputs.mustBeGreen }}) {
console.log('Checking green status: ' + branch);
- const statusResponse = await github.rest.repos.getCombinedStatusForRef({
+ const check_runs = await github.paginate('GET /repos/{owner}/{repo}/commits/{ref}/check-runs', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: branch
});
- const state = statusResponse['data']['state'];
- console.log('Validating status: ' + state);
- if(state != 'success') {
- console.log('Discarding ' + branch + ' with status ' + state);
- statusOK = false;
+ for (const cr of check_runs.data.check_runs) {
+ console.log('Validating check conclusion: ' + cr.conclusion);
+ if(cr.conclusion != 'success') {
+ console.log('Discarding ' + branch + ' with check conclusion ' + cr.conclusion);
+ statusOK = false;
}
}
Hey, the latest release, 1.3.0, uses a new API that checks the PR/branch status in a way that works both for statuses set with GitHub Actions CI, and external tools. As such this issue should be fixed now. If for any reason it doesn't work for you, let me know!
Thanks @martingjaldbaek ! I will incorporate the latest changes in our workflow.
Hey! Thanks for the workflow, first of all. I integrated it into https://github.com/SpoonLabs/sorald/ and it worked quite well. However, I had to fix the checking of CI status for each PR in the workflow. The URL here kept returning
pending
even though I am sure the CI was completed with exit code 0. This has also been reported on GitHub community forum.