-
Couldn't load subscription status.
- Fork 7.3k
Support "all failed jobs" and individual job re-run for a github actions workflow run #5275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this!
i tested the argument processing stuff and it seems good 👍 I would like to QA this again once the feature flag is flipped and before we release on Tuesday.
|
@vilmibm - if you use it against github staff repos, you can QA it now as it is staff shipped, or I can flag in any additional repos, just message me |
|
oh sick--can you add vilmibm/testing? |
|
@vilmibm Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Housekeeping items remain
pkg/cmd/run/rerun/rerun.go
Outdated
| if err != nil { | ||
| return err | ||
| } | ||
| if opts.IO.CanPrompt() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize it was like this before the feature additions, but if we could make just a bit of housekeeping while we're here, I would suggest replacing these CanPrompt() guards with IsStdoutTTY(). The reason is that we're not checking for whether the command can prompt the user, but whether the output is going to a terminal and not, for example, as part of a script. These checks are often aligned but not always.
pkg/cmd/run/rerun/rerun.go
Outdated
| opts.RunID = "" | ||
| if opts.IO.CanPrompt() { | ||
| cs := opts.IO.ColorScheme() | ||
| fmt.Fprintf(opts.IO.ErrOut, "%s both run and job IDs specified; ignoring run ID\n", cs.WarningIcon()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of ignoring a piece of input, should we error out in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I'll return cmdutil.FlagErrorf instead.
I took the pattern from
Lines 130 to 135 in d4ead71
| if opts.RunID != "" && opts.JobID != "" { | |
| opts.RunID = "" | |
| if opts.IO.CanPrompt() { | |
| cs := opts.IO.ColorScheme() | |
| fmt.Fprintf(opts.IO.ErrOut, "%s both run and job IDs specified; ignoring run ID\n", cs.WarningIcon()) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of backwards compatibility, let's not change where it was allowed before
pkg/cmd/run/rerun/rerun.go
Outdated
| if err != nil { | ||
| return err | ||
| } | ||
| if opts.IO.CanPrompt() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto CanPrompt → IsStdoutTTY
pkg/cmd/run/rerun/rerun.go
Outdated
| cs := opts.IO.ColorScheme() | ||
| fmt.Fprintf(opts.IO.ErrOut, "%s both run and job IDs specified; ignoring run ID\n", cs.WarningIcon()) | ||
| } | ||
| return cmdutil.FlagErrorf("specify only one of <run-id> or <job-id>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: since <job-id> is not a placeholder anywhere, it can be confusing to see this. When we're referring to flags, we usually name them by their full usage: --job (in backticks)
This PR implements 2 new flags to the
gh run rerunworkflow, to support the upcoming work to allow running only the failed jobs from a GitHub Actions workflow run (--failed) and a specific job from a workflow (--job <job-id>).The endpoints referenced here are NOT yet released publicly, so this PR should not be merged yet, but hopefully can merge shortly after we launch.
Our internal issue tracking this is https://github.com/github/cli/issues/110, let me know if I should create one in this repo as well.
Also first time contributing here so open to any and all feedback, thanks in advance!! 🙇