scan #42
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: scan | |
| on: | |
| schedule: | |
| # 22:30 UTC = 18:30 EDT / 17:30 EST. GitHub Actions cron is UTC-only and | |
| # does NOT follow DST. Two crons bracket the DST shift; the scan dedupes | |
| # on URL so the second run is a cheap no-op except in EST when it | |
| # becomes the real run. | |
| - cron: '30 22 * * 1-5' | |
| - cron: '30 23 * * 1-5' | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: scan | |
| cancel-in-progress: false | |
| jobs: | |
| scan: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: pip | |
| - name: Install package | |
| run: pip install -e . | |
| - name: Install Playwright Chromium | |
| run: playwright install --with-deps chromium | |
| - name: Run scan | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GMAIL_SENDER: ${{ secrets.GMAIL_SENDER }} | |
| GMAIL_APP_PASSWORD: ${{ secrets.GMAIL_APP_PASSWORD }} | |
| ALERT_RECIPIENT: ${{ secrets.ALERT_RECIPIENT }} | |
| run: fed-chirp scan --summary-file /tmp/scan-summary.md | |
| - name: Append scan summary to workflow run page | |
| if: always() | |
| run: | | |
| if [ -f /tmp/scan-summary.md ]; then | |
| cat /tmp/scan-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "scan-summary.md not produced (scan likely failed before summary write)" >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - name: Commit updated DB + dashboard | |
| run: | | |
| git config user.name "fed-chirp-bot" | |
| git config user.email "fed-chirp-bot@users.noreply.github.com" | |
| git add data/fed_chirp.sqlite dashboard/index.html | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| else | |
| if [ -f /tmp/scan-summary.md ]; then | |
| git commit -F /tmp/scan-summary.md | |
| else | |
| git commit -m "scan: $(date -u +%Y-%m-%dT%H:%MZ)" | |
| fi | |
| git push | |
| fi |