MCPcopy
hub / github.com/cli/cli / rerunJob

Function rerunJob

pkg/cmd/run/rerun/rerun.go:212–229  ·  view source on GitHub ↗
(client *api.Client, repo ghrepo.Interface, job *shared.Job, debug bool)

Source from the content-addressed store, hash-verified

210}
211
212func rerunJob(client *api.Client, repo ghrepo.Interface, job *shared.Job, debug bool) error {
213 body, err := requestBody(debug)
214 if err != nil {
215 return fmt.Errorf("failed to create rerun body: %w", err)
216 }
217
218 path := fmt.Sprintf("repos/%s/actions/jobs/%d/rerun", ghrepo.FullName(repo), job.ID)
219
220 err = client.REST(repo.RepoHost(), "POST", path, body, nil)
221 if err != nil {
222 var httpError api.HTTPError
223 if errors.As(err, &httpError) && httpError.StatusCode == 403 {
224 return fmt.Errorf("job %d cannot be rerun", job.ID)
225 }
226 return fmt.Errorf("failed to rerun: %w", err)
227 }
228 return nil
229}
230
231type RerunPayload struct {
232 Debug bool `json:"enable_debug_logging"`

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