Skip to content

Validate Event Sources #44

Validate Event Sources

Validate Event Sources #44

name: Validate Event Sources
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * *' # 9am UTC daily
jobs:
validate-events:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend/scripts
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --prefer-binary -r ../requirements.txt
- name: Create logs directory
run: mkdir -p logs
- name: Purge old IgnoredPost rows
run: |
python purge_old_ignored_posts.py
- name: Run validation script
run: |
python validate_event_sources.py --school "University of Waterloo" --workers 10 2>&1 | tee logs/validation.log
continue-on-error: false
- name: Upload logs as artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: validation-logs-${{ github.run_number }}
path: |
logs/
*.log
retention-days: 30
- name: Check for deleted events
if: always()
run: |
if grep -q "Events deleted:" logs/validation.log; then
DELETED=$(grep "Events deleted:" logs/validation.log | awk '{print $NF}')
echo "::notice::Deleted $DELETED invalid events"
fi