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

Function rerunJob

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

Source from the content-addressed store, hash-verified

215}
216
217func rerunJob(client *api.Client, repo ghrepo.Interface, job *shared.Job, debug bool) error {
218 body, err := requestBody(debug)
219 if err != nil {
220 return fmt.Errorf("failed to create rerun body: %w", err)
221 }
222
223 path, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "actions", "jobs", strconv.FormatInt(job.ID, 10), "rerun")
224 if err != nil {
225 return err
226 }
227
228 err = client.REST(repo.RepoHost(), "POST", path.String(), body, nil)
229 if err != nil {
230 var httpError api.HTTPError
231 if errors.As(err, &httpError) && httpError.StatusCode == 403 {
232 return fmt.Errorf("job %d cannot be rerun", job.ID)
233 }
234 return fmt.Errorf("failed to rerun: %w", err)
235 }
236 return nil
237}
238
239type RerunPayload struct {
240 Debug bool `json:"enable_debug_logging"`

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