Enforce documentation change for a new-feature PR

This commit is contained in:
Mikhail f. Shiryaev 2023-04-24 10:39:49 +02:00
parent 426221cadf
commit caee710fcc
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4
3 changed files with 18 additions and 5 deletions

View File

@ -383,15 +383,16 @@ CI_CONFIG = {
# checks required by Mergeable Check # checks required by Mergeable Check
REQUIRED_CHECKS = [ REQUIRED_CHECKS = [
"Fast test",
"Style Check",
"ClickHouse build check", "ClickHouse build check",
"ClickHouse special build check", "ClickHouse special build check",
"Docs Check",
"Fast test",
"Stateful tests (release)", "Stateful tests (release)",
"Stateless tests (release)", "Stateless tests (release)",
"Unit tests (release-clang)", "Style Check",
"Unit tests (asan)", "Unit tests (asan)",
"Unit tests (msan)", "Unit tests (msan)",
"Unit tests (release-clang)",
"Unit tests (tsan)", "Unit tests (tsan)",
"Unit tests (ubsan)", "Unit tests (ubsan)",
] ]

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import atexit
import logging import logging
import subprocess import subprocess
import os import os
@ -8,7 +9,7 @@ import sys
from github import Github from github import Github
from clickhouse_helper import ClickHouseHelper, prepare_tests_results_for_clickhouse from clickhouse_helper import ClickHouseHelper, prepare_tests_results_for_clickhouse
from commit_status_helper import post_commit_status, get_commit from commit_status_helper import post_commit_status, get_commit, update_mergeable_check
from docker_pull_helper import get_image_with_version from docker_pull_helper import get_image_with_version
from env_helper import TEMP_PATH, REPO_COPY from env_helper import TEMP_PATH, REPO_COPY
from get_robot_token import get_best_robot_token from get_robot_token import get_best_robot_token
@ -56,6 +57,7 @@ def main():
if rerun_helper.is_already_finished_by_status(): if rerun_helper.is_already_finished_by_status():
logging.info("Check is already finished according to github status, exiting") logging.info("Check is already finished according to github status, exiting")
sys.exit(0) sys.exit(0)
atexit.register(update_mergeable_check, gh, pr_info, NAME)
if not pr_info.has_changes_in_documentation() and not args.force: if not pr_info.has_changes_in_documentation() and not args.force:
logging.info("No changes in documentation") logging.info("No changes in documentation")

View File

@ -13,6 +13,7 @@ from commit_status_helper import (
remove_labels, remove_labels,
set_mergeable_check, set_mergeable_check,
) )
from docs_check import NAME as DOCS_NAME
from env_helper import GITHUB_RUN_URL, GITHUB_REPOSITORY, GITHUB_SERVER_URL from env_helper import GITHUB_RUN_URL, GITHUB_REPOSITORY, GITHUB_SERVER_URL
from get_robot_token import get_best_robot_token from get_robot_token import get_best_robot_token
from pr_info import FORCE_TESTS_LABEL, PRInfo from pr_info import FORCE_TESTS_LABEL, PRInfo
@ -27,6 +28,7 @@ TRUSTED_ORG_IDS = {
OK_SKIP_LABELS = {"release", "pr-backport", "pr-cherrypick"} OK_SKIP_LABELS = {"release", "pr-backport", "pr-cherrypick"}
CAN_BE_TESTED_LABEL = "can be tested" CAN_BE_TESTED_LABEL = "can be tested"
DO_NOT_TEST_LABEL = "do not test" DO_NOT_TEST_LABEL = "do not test"
FEATURE_LABEL = "pr-feature"
SUBMODULE_CHANGED_LABEL = "submodule changed" SUBMODULE_CHANGED_LABEL = "submodule changed"
# They are used in .github/PULL_REQUEST_TEMPLATE.md, keep comments there # They are used in .github/PULL_REQUEST_TEMPLATE.md, keep comments there
@ -249,7 +251,15 @@ if __name__ == "__main__":
if pr_labels_to_remove: if pr_labels_to_remove:
remove_labels(gh, pr_info, pr_labels_to_remove) remove_labels(gh, pr_info, pr_labels_to_remove)
set_mergeable_check(commit, "skipped") if FEATURE_LABEL in pr_labels_to_add:
print(f"The '{FEATURE_LABEL}' in the labels, expect the 'Docs Check' status")
commit.create_status(
context=DOCS_NAME,
description=f"expect adding docs for {FEATURE_LABEL}",
state="pending",
)
else:
set_mergeable_check(commit, "skipped")
if description_error: if description_error:
print( print(