updating worflows #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: HTML validate | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/*.md' | |
| - '**/*.html' | |
| - '_config.yml' | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| jobs: | |
| html-validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Pages build (Jekyll) | |
| uses: actions/configure-pages@v5 | |
| - name: Build with Jekyll (GitHub Pages environment) | |
| uses: actions/jekyll-build-pages@v1 | |
| with: | |
| source: ./ | |
| destination: ./_site | |
| - name: Cache npm (html-validate) | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm-html-validate-8 | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install html-validate | |
| run: npm install -g html-validate@8 | |
| - name: Run html-validate | |
| run: | | |
| if [ ! -d _site ]; then | |
| echo "_site missing; Jekyll build failed" >&2 | |
| exit 1 | |
| fi | |
| html-validate --config .htmlvalidate.json _site > html-validate-report.txt | |
| EXIT_CODE=$? | |
| if [ "$EXIT_CODE" -ne 0 ]; then | |
| echo "HTML validation failed (exit $EXIT_CODE). See artifact." >&2 | |
| exit $EXIT_CODE | |
| fi | |
| - name: Upload validation report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-validate-report | |
| path: html-validate-report.txt | |
| - name: Summary | |
| if: always() | |
| run: | | |
| echo "### HTML Validation Summary" >> $GITHUB_STEP_SUMMARY | |
| if grep -qi "error" html-validate-report.txt; then | |
| echo "Errors detected. See artifact." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "No errors detected." >> $GITHUB_STEP_SUMMARY | |
| fi |