-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
docsgh-prrelating to the gh pr commandrelating to the gh pr commandhelp wantedContributions welcomeContributions welcome
Description
Describe the bug
The help describes pr checks as
Show CI status for a single pull request.
From that description, I expect that it returns an error code if there are failed checks, maybe an error code if there are pending checks, and 0 for all checks successful.
I do not expect it to fail when there are no checks, because there is no negative CI status
gh version 2.53.0 (2024-07-17)
Steps to reproduce the behavior
- On a PR with no checks, run
gh pr checks - return code is 1
Expected vs actual behavior
return code of 0
Proposed solution
Document return codes in the help
Looks like
- 8: pending checks
- 0: all checks passed
- 1: no checks
- 1: failed check
Separate return code for no checks and failed check
It would be cool if no checks returned 0, but as long as I can separate it from failed checks without grep I'm okay
workaround
if (gh pr checks 2>&1 || true) | grep -qE "^All checks were successful|^no checks reported" ; then
...
fi
jtmcg
Metadata
Metadata
Assignees
Labels
docsgh-prrelating to the gh pr commandrelating to the gh pr commandhelp wantedContributions welcomeContributions welcome