.github/workflows/health-check.yml

69 lines · 1904 bytes

 1name: 🩺 Listing Health Checks
 2
 3on:
 4  workflow_dispatch:
 5    inputs:
 6      category:
 7        description: Just run for specific category (optional)
 8        type: string
 9      section:
10        description: Just run for a specific section (optional)
11        type: string
12      service:
13        description: Just run for a specific entry (optional)
14        type: string
15
16permissions:
17  contents: read
18
19jobs:
20  health-check:
21    name: Health check
22    runs-on: ubuntu-latest
23    steps:
24      - uses: actions/checkout@v5
25
26      - uses: actions/setup-python@v6
27        with:
28          python-version: "3.12"
29
30      - name: Install dependencies
31        run: pip install -q -r lib/requirements.txt
32
33      - name: Run health check
34        id: check
35        continue-on-error: true
36        env:
37          GITHUB_TOKEN: ${{ github.token }}
38          CATEGORY: ${{ inputs.category }}
39          SECTION: ${{ inputs.section }}
40          SERVICE: ${{ inputs.service }}
41        run: |
42          args=()
43          [ -n "$CATEGORY" ] && args+=(--category "$CATEGORY")
44          [ -n "$SECTION" ]  && args+=(--section  "$SECTION")
45          [ -n "$SERVICE" ]  && args+=(--service  "$SERVICE")
46          python lib/review-listings.py "${args[@]}" \
47            --save-json /tmp/findings.json \
48            --save-markdown /tmp/findings.md
49
50      - name: Write summary
51        if: always()
52        run: |
53          if [ -f /tmp/findings.md ]; then
54            cat /tmp/findings.md >> "$GITHUB_STEP_SUMMARY"
55          else
56            echo "We somehow lost the /tmp/findings.md file"
57          fi
58
59      - name: Upload findings JSON
60        if: always()
61        uses: actions/upload-artifact@v6
62        with:
63          name: listing-health-findings
64          path: /tmp/findings.json
65          if-no-files-found: ignore
66
67      - name: Fail if critical issues
68        if: steps.check.outcome == 'failure'
69        run: exit 1