ClickHouse/tests/ci/finish_check.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.2 KiB
Python
Raw Normal View History

2021-09-29 07:47:15 +00:00
#!/usr/bin/env python3
import logging
from github import Github
2021-11-26 14:00:09 +00:00
from commit_status_helper import (
2023-04-20 11:55:33 +00:00
CI_STATUS_NAME,
get_commit,
get_commit_filtered_statuses,
post_commit_status,
trigger_mergeable_check,
)
2023-04-20 11:55:33 +00:00
from get_robot_token import get_best_robot_token
from pr_info import PRInfo
from report import PENDING, SUCCESS
2021-09-29 07:47:15 +00:00
2021-11-26 14:00:09 +00:00
2023-04-20 11:55:33 +00:00
def main():
2021-09-29 07:47:15 +00:00
logging.basicConfig(level=logging.INFO)
2021-11-26 14:00:09 +00:00
pr_info = PRInfo(need_orgs=True)
gh = Github(get_best_robot_token(), per_page=100)
2021-09-29 07:47:15 +00:00
commit = get_commit(gh, pr_info.sha)
# Unconditionally update the Mergeable Check at the final step
statuses = get_commit_filtered_statuses(commit)
trigger_mergeable_check(commit, statuses)
2024-04-17 20:23:41 +00:00
if not pr_info.is_merge_queue:
2024-04-11 11:58:44 +00:00
statuses = [s for s in statuses if s.context == CI_STATUS_NAME]
if not statuses:
return
# Take the latest status
status = statuses[-1]
if status.state == PENDING:
post_commit_status(
commit,
SUCCESS,
status.target_url,
"All checks finished",
CI_STATUS_NAME,
pr_info,
dump_to_file=True,
)
2023-04-20 11:55:33 +00:00
if __name__ == "__main__":
main()