Post a failure status if can not run the CI

This commit is contained in:
Mikhail f. Shiryaev 2024-01-31 17:59:13 +01:00
parent a193e01c8f
commit 0f931057e9
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -1,11 +1,14 @@
#!/usr/bin/env python3
import atexit
import sys
import logging
import sys
from typing import Tuple
# isort: off
from github import Github
# isort: on
from commit_status_helper import (
CI_STATUS_NAME,
create_ci_report,
@ -18,12 +21,12 @@ from commit_status_helper import (
)
from env_helper import GITHUB_REPOSITORY, GITHUB_SERVER_URL
from get_robot_token import get_best_robot_token
from pr_info import FORCE_TESTS_LABEL, PRInfo
from lambda_shared_package.lambda_shared.pr import (
CATEGORY_TO_LABEL,
TRUSTED_CONTRIBUTORS,
check_pr_description,
)
from pr_info import FORCE_TESTS_LABEL, PRInfo
from report import FAILURE
TRUSTED_ORG_IDS = {
@ -146,7 +149,7 @@ def main():
)
post_commit_status(
commit,
"failure",
FAILURE,
url,
format_description(description_error),
PR_CHECK,
@ -170,6 +173,14 @@ def main():
# allow the workflow to continue
if not can_run:
post_commit_status(
commit,
FAILURE,
"",
description,
PR_CHECK,
pr_info,
)
print("::notice ::Cannot run")
sys.exit(1)