diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index 9cf4af5a599..141a8c6bbf8 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -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 +