From 10b46d1351f6bd17172228a382729a6a72aaf970 Mon Sep 17 00:00:00 2001 From: Shaun Struwig <41984034+Blargian@users.noreply.github.com> Date: Mon, 20 Jan 2025 19:22:08 +0100 Subject: [PATCH] add to GH action --- .github/workflows/check-build.yml | 16 ++++++++++++---- scripts/knowledgebase_article_checker.py | 20 +++++++------------- scripts/knowledgebase_tags.txt | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index e3181dbbde0..8b620d3dff5 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -31,10 +31,18 @@ jobs: continue-on-error: true id: spellcheck - # Step 4: Fail the build if the script returns exit code 1 + # Step 4: Run knowledgebase article checker + - name: Check KB + run: | + ./scripts/knowledgebase_article_checker.py + continue-on-error: true + id: kbcheck + + # Step 5: Fail the build if any script returns exit code 1 - name: Check exit code run: | - if [ ${{ steps.spellcheck.outcome }} == 'failure' ]; then - echo "Spellcheck failed. See the logs for details." - exit 1 + if [[ "${{ steps.spellcheck.outcome }}" == "failure" ]] || [[ "${{ steps.kbcheck.outcome }}" == "failure" ]]; then + echo "Style check failed. See the logs for details." + exit 1 fi + diff --git a/scripts/knowledgebase_article_checker.py b/scripts/knowledgebase_article_checker.py index 7454c039a58..f81027723ed 100644 --- a/scripts/knowledgebase_article_checker.py +++ b/scripts/knowledgebase_article_checker.py @@ -80,17 +80,11 @@ def check_yaml_tags(directory, allowed_tags): def main(): - allowed_tags = \ - [ - 'Concepts', 'Migrations', 'Use Cases', 'Best Practices', 'Managing Cloud', - 'Security and Authentication', 'Cloud Migration', 'Core Data Concepts', 'Managing Data', - 'Updating Data', 'Data Modelling', 'Deleting Data', 'Performance and Optimizations', - 'Server Admin', 'Deployments and Scaling', 'Settings', 'Tools and Utilities', 'System Tables', - 'Functions', 'Engines', 'Language Clients', 'ClickPipes', 'Native Clients and Interfaces', - 'Data Sources', 'Data Visualization', 'Data Formats', 'Data Ingestion', 'Data Export', 'chDB', - 'Errors and Exceptions', 'Community' - ] - + with open('knowledgebase_tags.txt','r') as file: + allowed_tags = [] + for line in file: + line = line.strip() + allowed_tags.append(line) args = parse_args() result = check_yaml_tags(args.kb_dir, allowed_tags) @@ -102,10 +96,10 @@ def main(): print("\n") print("Please make sure knowledgebase articles are tagged with at least one of the following tags: \n") print(allowed_tags) - return -1 + return 1 else: print(colored("Success: KB article tag checker did not find any articles missing tags.",'green')) - return 1 + return 0 if __name__ == "__main__": main() diff --git a/scripts/knowledgebase_tags.txt b/scripts/knowledgebase_tags.txt index dcb85f9f198..6140ab88a21 100644 --- a/scripts/knowledgebase_tags.txt +++ b/scripts/knowledgebase_tags.txt @@ -28,4 +28,4 @@ Data Ingestion Data Export chDB Errors and Exceptions -Community \ No newline at end of file +Community