show error message for rerun workflow older than a month ago

This commit is contained in:
Rajhans Jadhao 2025-01-13 19:21:58 +05:30
parent a6ea8fe4ed
commit b41b77165b
No known key found for this signature in database
GPG key ID: B5349190048085C9

View file

@ -202,6 +202,9 @@ func rerunRun(client *api.Client, repo ghrepo.Interface, run *shared.Run, onlyFa
if err != nil {
var httpError api.HTTPError
if errors.As(err, &httpError) && httpError.StatusCode == 403 {
if httpError.Message == "Unable to retry this workflow run because it was created over a month ago" {
return fmt.Errorf("run %d cannot be rerun; %s", run.ID, httpError.Message)
}
return fmt.Errorf("run %d cannot be rerun; its workflow file may be broken", run.ID)
}
return fmt.Errorf("failed to rerun: %w", err)