Esempio n. 1
0
NAME = "Docs Check (actions)"

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)

    temp_path = os.path.join(os.getenv("TEMP_PATH"))
    repo_path = os.path.join(os.getenv("REPO_COPY"))

    with open(os.getenv('GITHUB_EVENT_PATH'), 'r',
              encoding='utf-8') as event_file:
        event = json.load(event_file)

    pr_info = PRInfo(event, need_changed_files=True)

    gh = Github(get_best_robot_token())
    if not pr_info.has_changes_in_documentation():
        logging.info("No changes in documentation")
        commit = get_commit(gh, pr_info.sha)
        commit.create_status(context=NAME,
                             description="No changes in docs",
                             state="success")
        sys.exit(0)

    logging.info("Has changes in docs")

    if not os.path.exists(temp_path):
        os.makedirs(temp_path)

    docker_image = get_image_with_version(temp_path, 'clickhouse/docs-check')

    test_output = os.path.join(temp_path, 'docs_check_log')
Esempio n. 2
0
    stopwatch = Stopwatch()

    temp_path = TEMP_PATH
    repo_path = REPO_COPY

    pr_info = PRInfo(need_changed_files=True)

    gh = Github(get_best_robot_token())

    rerun_helper = RerunHelper(gh, pr_info, NAME)
    if rerun_helper.is_already_finished_by_status():
        logging.info("Check is already finished according to github status, exiting")
        sys.exit(0)

    if not pr_info.has_changes_in_documentation() and not args.force:
        logging.info("No changes in documentation")
        commit = get_commit(gh, pr_info.sha)
        commit.create_status(
            context=NAME, description="No changes in docs", state="success"
        )
        sys.exit(0)

    if pr_info.has_changes_in_documentation():
        logging.info("Has changes in docs")
    elif args.force:
        logging.info("Check the docs because of force flag")

    if not os.path.exists(temp_path):
        os.makedirs(temp_path)