-
Notifications
You must be signed in to change notification settings - Fork 6.5k
gh run rerun #3333
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
gh run rerun #3333
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.
Looks good!
@@ -150,6 +150,25 @@ type RunsPayload struct { | |||
WorkflowRuns []Run `json:"workflow_runs"` | |||
} | |||
|
|||
func GetRunsWithFilter(client *api.Client, repo ghrepo.Interface, limit int, f func(Run) bool) ([]Run, error) { |
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: couldn't the caller just do the filtering on the result of GetRuns instead of having to inject a filter func?
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 have to filter in this way for another upcoming command and it seemed like a reasonable time to DRY but I do not have strong feelings either way
if len(runs) == 0 { | ||
return errors.New("no recent runs have failed; please specify a specific run ID") | ||
} | ||
runID, err = shared.PromptForRun(cs, runs) |
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.
Not new in this PR, but: I still don't think that it's safe to use ANSI color sequences in Survey prompt options. #2923 (comment)
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
oh this is already done. where are you seeing ANSI color codes going into survey?
PromptForRun
does not use any color.
pkg/cmd/run/rerun/rerun.go
Outdated
Use: "rerun [<run-id>]", | ||
Short: "Rerun a given run", | ||
Args: cobra.MaximumNArgs(1), | ||
Hidden: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment 8000 h3>
The reason will be displayed to describe this comment to others. Learn more.
Do we need to explicitly hide subcommands if the parent command is already hidden?
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 don't think so, it was just a reflex.
This PR implements
gh run rerun
, a simple wrapper around theactions/runs/<run-id>/rerun
API endpoint.This PR also adds
GetRunsWithFilter
which I intend to use ingh run watch
.