.github/workflows/health-check.yml

72 lines · 2055 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  schedule:
16    - cron: '0 17 * * 5'  # Weekly drift check. 5PM on a Friday, in time for weekend updates
17
18permissions:
19  contents: read
20
21jobs:
22  health-check:
23    name: Health check
24    runs-on: ubuntu-latest
25    steps:
26      - uses: actions/checkout@v5
27
28      - uses: actions/setup-python@v6
29        with:
30          python-version: "3.12"
31
32      - name: Install dependencies
33        run: pip install -q -r lib/requirements.txt
34
35      - name: Run health check
36        id: check
37        continue-on-error: true
38        env:
39          GITHUB_TOKEN: ${{ github.token }}
40          API_TOKEN: ${{ secrets.API_TOKEN }}
41          CATEGORY: ${{ inputs.category }}
42          SECTION: ${{ inputs.section }}
43          SERVICE: ${{ inputs.service }}
44        run: |
45          args=()
46          [ -n "$CATEGORY" ] && args+=(--category "$CATEGORY")
47          [ -n "$SECTION" ]  && args+=(--section  "$SECTION")
48          [ -n "$SERVICE" ]  && args+=(--service  "$SERVICE")
49          python lib/review-listings.py "${args[@]}" \
50            --save-json /tmp/findings.json \
51            --save-markdown /tmp/findings.md
52
53      - name: Write summary
54        if: always()
55        run: |
56          if [ -f /tmp/findings.md ]; then
57            cat /tmp/findings.md >> "$GITHUB_STEP_SUMMARY"
58          else
59            echo "We somehow lost the /tmp/findings.md file"
60          fi
61
62      - name: Upload findings JSON
63        if: always()
64        uses: actions/upload-artifact@v6
65        with:
66          name: listing-health-findings
67          path: /tmp/findings.json
68          if-no-files-found: ignore
69
70      - name: Fail if critical issues
71        if: steps.check.outcome == 'failure'
72        run: exit 1