MCPcopy
hub / github.com/cli/cli / rerunRun

Function rerunRun

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

Source from the content-addressed store, hash-verified

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

Callers 1

runRerunFunction · 0.85

Calls 5

FullNameFunction · 0.92
requestBodyFunction · 0.85
ErrorfMethod · 0.65
RESTMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected