Skip to content

Commit

Permalink
add to GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
Blargian committed Jan 20, 2025
1 parent bb401ec commit 10b46d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 7 additions & 13 deletions scripts/knowledgebase_article_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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()
2 changes: 1 addition & 1 deletion scripts/knowledgebase_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Data Ingestion
Data Export
chDB
Errors and Exceptions
Community
Community

0 comments on commit 10b46d1

Please sign in to comment.