MCPcopy Create free account
hub / github.com/cli/cli / rerunRun

Function rerunRun

pkg/cmd/run/rerun/rerun.go:190–215  ·  view source on GitHub ↗
(client *api.Client, repo ghrepo.Interface, run *shared.Run, onlyFailed, debug bool)

Source from the content-addressed store, hash-verified

188}
189
190func rerunRun(client *api.Client, repo ghrepo.Interface, run *shared.Run, onlyFailed, debug bool) error {
191 runVerb := "rerun"
192 if onlyFailed {
193 runVerb = "rerun-failed-jobs"
194 }
195
196 body, err := requestBody(debug)
197 if err != nil {
198 return fmt.Errorf("failed to create rerun body: %w", err)
199 }
200
201 path, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "actions", "runs", strconv.FormatInt(run.ID, 10), runVerb)
202 if err != nil {
203 return err
204 }
205
206 err = client.REST(repo.RepoHost(), "POST", path.String(), body, nil)
207 if err != nil {
208 var httpError api.HTTPError
209 if errors.As(err, &httpError) && httpError.StatusCode == 403 {
210 return fmt.Errorf("run %d cannot be rerun; %s", run.ID, httpError.Message)
211 }
212 return fmt.Errorf("failed to rerun: %w", err)
213 }
214 return nil
215}
216
217func rerunJob(client *api.Client, repo ghrepo.Interface, job *shared.Job, debug bool) error {
218 body, err := requestBody(debug)

Callers 1

runRerunFunction · 0.85

Calls 8

JoinPathFunction · 0.92
requestBodyFunction · 0.85
ErrorfMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RESTMethod · 0.65
RepoHostMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected