You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
handle "no checks" races in pr checks --watch #7401
Describe the feature or problem you’d like to solve
After creating a PR, there's a time period where the GitHub API will say there are "no checks" for the PR and then, a few moments later, the checks will appear.
That means, if you gh pr create && gh pr checks --watch, sometimes pr checks --watch will error and return with exit code 1. (Specifically, the pr checks error text is no checks reported on the 'my-branch' branch)
Proposed solution
It would be nice for gh pr checks to either:
Determine somehow that the GitHub PR check resolution is in an intermediate state and wait for it to finish before saying there's no checks. I'm not sure if this is possible in the GitHub API but it's plausible!
Return a different exit code so that folks can tell if they could retry the pr checks call because they "know" there's checks on this pr.
@jmhodges-color Thanks for writing in, as you surmised option 1 as is not possible with the GitHub API, it does return any indication that there are any checks scheduled to run.
Option 2 I am not sure I understand. Generally the exit codes are for scriptability but pr checks --watch is a command that does not lend itself to be used in scripts IMO. Wouldn't it just be easier to do gh pr create && sleep 5 && gh pr checks --watch?
@jmhodges-color Thanks for writing in, as you surmised option 1 as is not possible with the GitHub API, it does return any indication that there are any checks scheduled to run.
Option 2 I am not sure I understand. Generally the exit codes are for scriptability but pr checks --watch is a command that does not lend itself to be used in scripts IMO. Wouldn't it just be easier to do gh pr create && sleep 5 && gh pr checks --watch?
Yes but unfortunately that means anyone wanting to use the fact that the checks failed to do other things (emit a notification, exit with an error instead of marking the PR as ready) wouldn't be able to do those things. Retry works fine for when you know the failures are only the race but not when there can be real failures.
@jmhodges-color That is a fair point. In other list commands we explicitly output a 0 exit code when there are no results, would something like that work for your situation? I will bring this up with the team to discuss a bit further.
@jmhodges-color That is a fair point. In other list commands we explicitly output a 0 exit code when there are no results, would something like that work for your situation? I will bring this up with the team to discuss a bit further.
@samcoe oh, specifically a 0 exit code doesn't work, because that'd make "no checks" the same as the "all checks passed" exit code. So, you'd mark PRs as ready or whatever when really it was just that you'd raced the API.
Tangentially, if there's a place for non-GitHub folks to post issues against the API, I'm happy to be an external request to add some kind of status field to checkable objects that the API uses to tell clients when it's not sure the checkable object has checks, yet
Oh, additional thing: capturing the output of --watch means you lose the nice progressively updating terminal output (without some trickery). So, it'd be nice to not have to grep the output.
Activity
[-]handle "no checks" case in `pr checks --watch`[/-][+]handle "no checks" races in `pr checks --watch`[/+]samcoe commentedon May 8, 2023
@jmhodges-color Thanks for writing in, as you surmised option 1 as is not possible with the GitHub API, it does return any indication that there are any checks scheduled to run.
Option 2 I am not sure I understand. Generally the exit codes are for scriptability but
pr checks --watchis a command that does not lend itself to be used in scripts IMO. Wouldn't it just be easier to dogh pr create && sleep 5 && gh pr checks --watch?jmhodges-color commentedon May 9, 2023
Yes but unfortunately that means anyone wanting to use the fact that the checks failed to do other things (emit a notification, exit with an error instead of marking the PR as ready) wouldn't be able to do those things. Retry works fine for when you know the failures are only the race but not when there can be real failures.
samcoe commentedon May 9, 2023
@jmhodges-color That is a fair point. In other
listcommands we explicitly output a 0 exit code when there are no results, would something like that work for your situation? I will bring this up with the team to discuss a bit further.jmhodges-color commentedon May 9, 2023
@samcoe oh, specifically a 0 exit code doesn't work, because that'd make "no checks" the same as the "all checks passed" exit code. So, you'd mark PRs as ready or whatever when really it was just that you'd raced the API.
Tangentially, if there's a place for non-GitHub folks to post issues against the API, I'm happy to be an external request to add some kind of status field to checkable objects that the API uses to tell clients when it's not sure the checkable object has checks, yet
samcoe commentedon May 10, 2023
@jmhodges-color Usually we direct people to here to leave feedback/bug reports/feature requests for the overall platform.
jmhodges-color commentedon May 26, 2023
Oh, additional thing: capturing the output of
--watchmeans you lose the nice progressively updating terminal output (without some trickery). So, it'd be nice to not have to grep the output.vilmibm commentedon Jul 17, 2023
I don't think we can be super helpful here given the API limitations so I'm going to close this after today's planning discussion
2 remaining items
feat(agent-env): 743 second wave — world-state query, exec substrate,…
fix(idd-ci): scope PR-check watch to required checks
fix(infra): replace the false-green CI gate with a verified-settle sc…
fix(dev): match both gh no-checks-yet message variants in checks-wait
fix(publish): merge gate consults required checks only (829 R1) (#445)
🐛 fix: bound every gh call in watch_ci; no false fail for a checkless PR
[ci] Surface GitHub CLI errors when reading PR checks (#9909)
docs(llm-assistants): wait for new PR checks and extend the DeepSeek …
docs(llm-assistants): wait for new PR checks and extend the DeepSeek …
docs(llm-assistants): wait for new PR checks and extend the DeepSeek …
docs(llm-assistants): wait for new PR checks and extend the DeepSeek …
docs(llm-assistants): wait for new PR checks and extend the DeepSeek …
using-devkit: a skipped or other-event run holds the --wait-ci wait
devkit ship --wait-ci: never report passed on a review bot alone; rea…
devkit ship --wait-ci: never report passed on a review bot alone; rea…