MCPcopy Index your code
hub / github.com/apache/tvm / rerun_github_actions

Method rerun_github_actions

ci/scripts/github/github_tvmbot.py:549–577  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

547 post(url, auth=("tvm-bot", TVM_BOT_JENKINS_TOKEN))
548
549 def rerun_github_actions(self) -> None:
550 workflow_ids = []
551 for item in self.head_commit()["statusCheckRollup"]["contexts"]["nodes"]:
552 if "checkSuite" in item and item["conclusion"] == "FAILURE":
553 workflow_id = item["checkSuite"]["workflowRun"]["databaseId"]
554 workflow_ids.append(workflow_id)
555
556 workflow_ids = list(set(workflow_ids))
557 logging.info(f"Rerunning GitHub Actions workflows with IDs: {workflow_ids}")
558 if self.dry_run:
559 actions_github = None
560 else:
561 actions_github = GitHubRepo(
562 user=self.github.user, repo=self.github.repo, token=GH_ACTIONS_TOKEN
563 )
564 for workflow_id in workflow_ids:
565 if self.dry_run:
566 logging.info(f"Dry run, not restarting workflow {workflow_id}")
567 else:
568 try:
569 actions_github.post(f"actions/runs/{workflow_id}/rerun-failed-jobs", data={})
570 except RuntimeError as e:
571 logging.exception(e)
572 # Ignore errors about jobs that are part of the same workflow to avoid
573 # having to figure out which jobs are in which workflows ahead of time
574 if "The workflow run containing this job is already running" in str(e):
575 pass
576 else:
577 raise e
578
579 def comment_failure(self, msg: str, exceptions: Exception | list[Exception]):
580 if not isinstance(exceptions, list):

Callers 1

runMethod · 0.80

Calls 6

head_commitMethod · 0.95
postMethod · 0.95
GitHubRepoClass · 0.90
strFunction · 0.85
infoMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected