8000 gh run rerun by vilmibm · Pull Request #3333 · cli/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 3 commits into from
Apr 2, 2021
Merged

gh run rerun #3333

merged 3 commits into from
Apr 2, 2021

Conversation

vilmibm
Copy link
Contributor
@vilmibm vilmibm commented Mar 30, 2021

This PR implements gh run rerun, a simple wrapper around the actions/runs/<run-id>/rerun API endpoint.

rerun

This PR also adds GetRunsWithFilter which I intend to use in gh run watch.

@vilmibm vilmibm marked this pull request as ready for review April 2, 2021 00:35
@vilmibm vilmibm requested review from mislav and samcoe April 2, 2021 00:35
@vilmibm vilmibm added the actions label Apr 2, 2021
Copy link
Contributor
@mislav mislav left a 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Use: "rerun [<run-id>]",
Short: "Rerun a given run",
Args: cobra.MaximumNArgs(1),
Hidden: true,
Copy link
Contributor
@mislav mislav Apr 2, 2021

Choose a reason for hiding this comment

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?

Copy link
Contributor Author

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.

@vilmibm vilmibm enabled auto-merge April 2, 2021 16:02
@vilmibm vilmibm merged commit 216cfb6 into trunk Apr 2, 2021
@mislav mislav deleted the run-rerun branch August 11, 2021 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0