Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions ci/scripts/github_tvmbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def __init__(
self.number = number
self.repo_name = repo
self.dry_run = dry_run
self.has_error = False

if dry_run and raw_data:
# In test mode there is no need to fetch anything
Expand Down Expand Up @@ -468,7 +469,10 @@ def find_missing_expected_jobs(self) -> List[str]:

def trigger_gha_ci(self, sha: str) -> None:
logging.info(f"POST-ing a workflow_dispatch event to main.yml")
r = self.github.post(
actions_github = GitHubRepo(
user=self.github.user, repo=self.github.repo, token=GH_ACTIONS_TOKEN
)
r = actions_github.post(
url="actions/workflows/main.yml/dispatches",
data={
"ref": "main",
Expand Down Expand Up @@ -537,9 +541,12 @@ def rerun_github_actions(self) -> None:

workflow_ids = list(set(workflow_ids))
logging.info(f"Rerunning GitHub Actions workflows with IDs: {workflow_ids}")
actions_github = GitHubRepo(
user=self.github.user, repo=self.github.repo, token=GH_ACTIONS_TOKEN
)
if self.dry_run:
actions_github = None
else:
actions_github = GitHubRepo(
user=self.github.user, repo=self.github.repo, token=GH_ACTIONS_TOKEN
)
for workflow_id in workflow_ids:
if self.dry_run:
logging.info(f"Dry run, not restarting workflow {workflow_id}")
Expand Down Expand Up @@ -576,6 +583,7 @@ def comment_failure(self, msg: str, exceptions: Union[Exception, List[Exception]
comment += "</details>"

pr.comment(comment)
pr.has_error = True
return exception


Expand Down Expand Up @@ -750,6 +758,9 @@ def run(pr: PR):
for name, check in command_to_run.auth:
if check(pr, comment, args):
logging.info(f"Passed auth check '{name}', continuing")
# Only one authorization check needs to pass (e.g. just mentionable
# or PR author), not all of them so quit
break
else:
logging.info(f"Failed auth check '{name}', quitting")
# Add a sad face
Expand All @@ -767,3 +778,6 @@ def run(pr: PR):

# Run the command
command_to_run.run(pr)

if pr.has_error:
raise RuntimeError("PR commented a failure")
130 changes: 0 additions & 130 deletions tests/python/ci/sample_prs/pr10786-badci.json

This file was deleted.

131 changes: 0 additions & 131 deletions tests/python/ci/sample_prs/pr10786-changes-requested.json

This file was deleted.

Loading