Upgrade ai-driven-analysis-guide to v3.0 and improve all news workflow AI prompts #4981
Workflow file for this run
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: Quality Checks | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| typescript-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| codeload.github.com:443 | |
| github.com:443 | |
| nodejs.org:443 | |
| objects.githubusercontent.com:443 | |
| registry.npmjs.org:443 | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: '25' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run ESLint | |
| run: | | |
| echo "🔍 Running ESLint on TypeScript & JavaScript files..." | |
| echo "" | |
| # Run ESLint and capture results | |
| if npm run lint > eslint-report.txt 2>&1; then | |
| echo "✅ All TypeScript & JavaScript files passed linting" | |
| cat eslint-report.txt | |
| else | |
| echo "⚠️ Linting found issues:" | |
| cat eslint-report.txt | |
| echo "" | |
| echo "📊 Linting completed with warnings/errors" | |
| exit 1 | |
| fi | |
| - name: Upload ESLint Report | |
| if: always() | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: eslint-report | |
| path: eslint-report.txt | |
| retention-days: 30 | |
| html-validation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| codeload.github.com:443 | |
| github.com:443 | |
| nodejs.org:443 | |
| objects.githubusercontent.com:443 | |
| registry.npmjs.org:443 | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: '25' | |
| - name: Cache npm global packages | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm-global-${{ hashFiles('**/package-lock.json') }}-htmlhint | |
| restore-keys: | | |
| ${{ runner.os }}-npm-global- | |
| - name: Install HTMLHint | |
| run: npm install -g htmlhint | |
| - name: Validate HTML | |
| run: | | |
| echo "🔍 Validating HTML files with HTMLHint..." | |
| echo "" | |
| # Build file list robustly (handles missing news/*.html gracefully) | |
| shopt -s nullglob | |
| html_files=(*.html) | |
| [[ -d news ]] && html_files+=(news/*.html) | |
| shopt -u nullglob | |
| # Run HTMLHint on all HTML files and capture results | |
| if htmlhint "${html_files[@]}" > htmlhint-report.txt 2>&1; then | |
| echo "✅ All HTML files passed validation" | |
| cat htmlhint-report.txt | |
| else | |
| echo "⚠️ HTML validation found issues:" | |
| cat htmlhint-report.txt | |
| echo "" | |
| echo "📊 Validation completed with warnings/errors" | |
| exit 1 | |
| fi | |
| - name: Upload HTMLHint Report | |
| if: always() | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: htmlhint-report | |
| path: htmlhint-report.txt | |
| retention-days: 30 | |
| link-checker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| cia.sourceforge.io:443 | |
| codeload.github.com:443 | |
| data.riksdagen.se:443 | |
| data.worldbank.org:443 | |
| github.com:443 | |
| nodejs.org:443 | |
| objects.githubusercontent.com:443 | |
| raw.githubusercontent.com:443 | |
| registry.npmjs.org:443 | |
| riksdagsmonitor.com:443 | |
| www.esv.se:443 | |
| www.hack23.com:443 | |
| www.linkedin.com:443 | |
| www.riksdagen.se:443 | |
| www.val.se:443 | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: '25' | |
| - name: Cache npm packages | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm-linkinator6-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm-linkinator6- | |
| - name: Cache apt packages | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: /var/cache/apt/archives | |
| key: ${{ runner.os }}-apt-${{ hashFiles('**/.github/workflows/quality-checks.yml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-apt- | |
| - name: Install linkinator@6 | |
| run: | | |
| echo "Installing linkinator v6 (v7.5.2 has module resolution bug)..." | |
| npm install -g linkinator@6 | |
| linkinator --version | |
| echo "✅ linkinator v6 installed successfully" | |
| - name: Check internal links (static files) | |
| run: | | |
| echo "🔍 Starting local HTTP server for internal link checking..." | |
| python3 -m http.server 8080 & | |
| SERVER_PID=$! | |
| echo "Server PID: $SERVER_PID" | |
| # Wait for server to start | |
| sleep 5 | |
| echo "" | |
| echo "🔗 Checking internal links on localhost..." | |
| # Check links on localhost using global linkinator v6 | |
| linkinator http://localhost:8080/ \ | |
| --recurse \ | |
| --skip "^(?!http://localhost:8080)" \ | |
| --format json > internal-links-report.json || true | |
| # Kill server | |
| kill $SERVER_PID 2>/dev/null || true | |
| # Parse and display results | |
| echo "" | |
| echo "📊 Internal Link Check Results:" | |
| if [ -f internal-links-report.json ]; then | |
| jq '.links[0:10]' internal-links-report.json | |
| # Count passed and failed links | |
| read passed failed < <(jq -r ' | |
| [([.links[] | select(.state == "OK")] | length), | |
| ([.links[] | select(.state != "OK")] | length)] | @tsv | |
| ' internal-links-report.json 2>/dev/null || echo "0 0") | |
| echo "" | |
| echo "✅ Passed: $passed links" | |
| echo "❌ Failed: $failed links" | |
| fi | |
| - name: Check external links (sample pages) | |
| run: | | |
| echo "" | |
| echo "🌐 Checking external links on deployed site (sample check)..." | |
| echo "Note: Only checking main index page to avoid rate limiting" | |
| # Check external links on deployed site | |
| linkinator https://riksdagsmonitor.com/ \ | |
| --skip "(fonts\.googleapis\.com|fonts\.gstatic\.com|github\.com)" \ | |
| --timeout 30000 \ | |
| --format json > external-links-report.json || true | |
| echo "" | |
| echo "📊 External Link Check Results:" | |
| if [ -f external-links-report.json ]; then | |
| jq '.links[0:10]' external-links-report.json | |
| # Count passed and failed links | |
| read passed failed < <(jq -r ' | |
| [([.links[] | select(.state == "OK")] | length), | |
| ([.links[] | select(.state != "OK")] | length)] | @tsv | |
| ' external-links-report.json 2>/dev/null || echo "0 0") | |
| echo "" | |
| echo "✅ Passed: $passed links" | |
| echo "❌ Failed: $failed links" | |
| echo "" | |
| echo "ℹ️ Note: External link checking is limited to avoid rate limiting" | |
| fi | |
| - name: Upload Link Check Reports | |
| if: always() | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: link-checker-reports | |
| path: | | |
| internal-links-report.json | |
| external-links-report.json | |
| retention-days: 30 | |
| summary: | |
| runs-on: ubuntu-latest | |
| needs: [typescript-lint, html-validation, link-checker] | |
| if: always() | |
| steps: | |
| - name: Harden Runner (block outbound calls) | |
| uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1 | |
| with: | |
| egress-policy: block | |
| - name: Quality Check Summary | |
| run: | | |
| echo "==========================================" | |
| echo " Quality Checks Completed" | |
| echo "==========================================" | |
| echo "" | |
| echo "✅ TypeScript & JavaScript linting completed" | |
| echo "✅ HTML validation completed" | |
| echo "✅ Link checking completed" | |
| echo "" | |
| echo "📊 Check artifacts for detailed reports:" | |
| echo " - eslint-report" | |
| echo " - htmlhint-report" | |
| echo " - link-checker-reports" | |
| echo "" | |
| echo "==========================================" |