Skip to content

Commit e0ce530

Browse files
committed
feat(actions): support rerun failed jobs
1 parent 4be498e commit e0ce530

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

src/main/java/org/kohsuke/github/GHWorkflowRun.java

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,41 @@ public PagedIterable<GHWorkflowJob> listJobs() {
598598
* the io exception
599599
*/
600600
public void rerun() throws IOException {
601-
root().createRequest().method("POST").withUrlPath(getApiRoute(), "rerun").send();
601+
rerun(false);
602+
}
603+
604+
/**
605+
* Rerun the workflow run.
606+
*
607+
* @param enableDebugLogging
608+
* whether to enable debug logging for the rerun
609+
* @throws IOException
610+
* the io exception
611+
*/
612+
public void rerun(boolean enableDebugLogging) throws IOException {
613+
rerun("rerun", enableDebugLogging);
614+
}
615+
616+
/**
617+
* Rerun failed jobs and their dependent jobs for this workflow run.
618+
*
619+
* @throws IOException
620+
* the io exception
621+
*/
622+
public void rerunFailedJobs() throws IOException {
623+
rerunFailedJobs(false);
624+
}
625+
626+
/**
627+
* Rerun failed jobs and their dependent jobs for this workflow run.
628+
*
629+
* @param enableDebugLogging
630+
* whether to enable debug logging for the rerun
631+
* @throws IOException
632+
* the io exception
633+
*/
634+
public void rerunFailedJobs(boolean enableDebugLogging) throws IOException {
635+
rerun("rerun-failed-jobs", enableDebugLogging);
602636
}
603637

604638
private String getApiRoute() {
@@ -611,6 +645,14 @@ private String getApiRoute() {
611645
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/actions/runs/" + getId();
612646
}
613647

648+
private void rerun(String endpoint, boolean enableDebugLogging) throws IOException {
649+
Requester requester = root().createRequest().method("POST").withUrlPath(getApiRoute(), endpoint);
650+
if (enableDebugLogging) {
651+
requester.with("enable_debug_logging", true);
652+
}
653+
requester.send();
654+
}
655+
614656
/**
615657
* Wrap up.
616658
*

0 commit comments

Comments
 (0)