Merge pull request #53413 from ClickHouse/quick-fail-undocumented-features

Quick fail undocumented features
This commit is contained in:
Mikhail f. Shiryaev 2023-08-14 16:58:58 +02:00 committed by GitHub
commit 9680de07e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -279,7 +279,7 @@ class PRInfo:
"user_orgs": self.user_orgs, "user_orgs": self.user_orgs,
} }
def has_changes_in_documentation(self): def has_changes_in_documentation(self) -> bool:
# If the list wasn't built yet the best we can do is to # If the list wasn't built yet the best we can do is to
# assume that there were changes. # assume that there were changes.
if self.changed_files is None or not self.changed_files: if self.changed_files is None or not self.changed_files:
@ -287,10 +287,9 @@ class PRInfo:
for f in self.changed_files: for f in self.changed_files:
_, ext = os.path.splitext(f) _, ext = os.path.splitext(f)
path_in_docs = "docs" in f path_in_docs = f.startswith("docs/")
path_in_website = "website" in f
if ( if (
ext in DIFF_IN_DOCUMENTATION_EXT and (path_in_docs or path_in_website) ext in DIFF_IN_DOCUMENTATION_EXT and path_in_docs
) or "docker/docs" in f: ) or "docker/docs" in f:
return True return True
return False return False

View File

@ -137,17 +137,20 @@ def 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)
if FEATURE_LABEL in pr_info.labels: if FEATURE_LABEL in pr_info.labels and not pr_info.has_changes_in_documentation():
print(f"The '{FEATURE_LABEL}' in the labels, expect the 'Docs Check' status") print(
f"The '{FEATURE_LABEL}' in the labels, "
"but there's no changed documentation"
)
post_commit_status( # do not pass pr_info here intentionally post_commit_status( # do not pass pr_info here intentionally
commit, commit,
"pending", "failure",
NotSet, NotSet,
f"expect adding docs for {FEATURE_LABEL}", f"expect adding docs for {FEATURE_LABEL}",
DOCS_NAME, DOCS_NAME,
pr_info,
) )
elif not description_error: sys.exit(1)
set_mergeable_check(commit, "skipped")
if description_error: if description_error:
print( print(
@ -173,6 +176,7 @@ def main():
) )
sys.exit(1) sys.exit(1)
set_mergeable_check(commit, "skipped")
ci_report_url = create_ci_report(pr_info, []) ci_report_url = create_ci_report(pr_info, [])
if not can_run: if not can_run:
print("::notice ::Cannot run") print("::notice ::Cannot run")