Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 20 additions & 28 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,39 @@ on:
jobs:
stylecheck:
runs-on: ubuntu-latest

strategy:
matrix:
check_type: [spellcheck, kbcheck]
steps:
# Step 1: Check out the repository
- name: Check out repository
uses: actions/checkout@v4

# Step 2: Set up environment if required (e.g., installing Aspell)
- uses: actions/checkout@v4
- name: Install Aspell
if: matrix.check_type == 'spellcheck'
run: sudo apt-get update && sudo apt-get install -y aspell aspell-en

# Step 3: Run the spellcheck script
- name: Run spellcheck
run: |
./scripts/check-doc-aspell
continue-on-error: true
id: spellcheck

# Step 4: Setup Python and dependencies for KB checker
- name: Set up Python
if: matrix.check_type == 'kbcheck'
uses: actions/setup-python@v5
with:
python-version: '3.x'

# Step 5: Install Python dependencies
- name: Install dependencies
if: matrix.check_type == 'kbcheck'
run: |
python -m pip install --upgrade pip
pip install -r 'scripts/knowledgebase-checker/requirements.txt'

# Step 5: Run knowledgebase article checker
- name: Check KB
- name: Run checks
id: check_step
run: |
./scripts/knowledgebase-checker/knowledgebase_article_checker.py --kb-dir="knowledgebase"
continue-on-error: true
id: kbcheck

# Step 6: Fail the build if any script returns exit code 1
- name: Check exit code
run: |
if [[ "${{ steps.spellcheck.outcome }}" == "failure" ]] || [[ "${{ steps.kbcheck.outcome }}" == "failure" ]]; then
echo "Style check failed. See the logs for details."
if [[ "${{ matrix.check_type }}" == "spellcheck" ]]; then
./scripts/check-doc-aspell
exit_code=$?
elif [[ "${{ matrix.check_type }}" == "kbcheck" ]]; then
./scripts/knowledgebase-checker/knowledgebase_article_checker.py --kb-dir="knowledgebase"
exit_code=$?
fi

if [[ $exit_code -ne 0 ]]; then
echo "::error::${{ matrix.check_type }} check failed. See logs for details."
exit 1
fi