driazati commented on code in PR #12295:
URL: https://github.com/apache/tvm/pull/12295#discussion_r938067104


##########
tests/scripts/github_tvmbot.py:
##########
@@ -503,6 +523,30 @@ def rerun_jenkins_ci(self) -> None:
         else:
             post(url, auth=("tvm-bot", TVM_BOT_JENKINS_TOKEN))
 
+    def rerun_github_actions(self) -> None:
+        job_ids = []
+        for item in 
self.head_commit()["statusCheckRollup"]["contexts"]["nodes"]:
+            if "checkSuite" in item:
+                job_ids.append(item["databaseId"])
+
+        logging.info(f"Rerunning GitHub Actions jobs with IDs: {job_ids}")
+        actions_github = GitHubRepo(
+            user=self.github.user, repo=self.github.repo, 
token=GH_ACTIONS_TOKEN
+        )
+        for job_id in job_ids:
+            if self.dry_run:
+                try:
+                    actions_github.post(f"actions/jobs/{job_id}/rerun", 
data={})
+                except RuntimeError as e:
+                    # Ignore errors about jobs that are part of the same 
workflow to avoid
+                    # having to figure out which jobs are in which workflows 
ahead of time
+                    if "The workflow run containing this job is already 
running" in str(e):

Review Comment:
   I think (like 70% certain) this only comes up for double-requesting a re-run 
of the same job, so it should still restart everything from the previous set of 
jobs. Restarting only failed jobs is a good idea, I'll leave it for a follow up 
PR though



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to