Skip to content

Generate SNOMED Reports #1

Generate SNOMED Reports

Generate SNOMED Reports #1

name: Generate SNOMED Reports
on:
schedule:
# Runs automatically on the 2nd of each month at 3 AM UTC
- cron: "0 3 2 * *"
# Allows manual execution at any time via GitHub UI:
# Actions -> Generate SNOMED Reports -> Run workflow
workflow_dispatch:
jobs:
build-reports:
runs-on: ubuntu-latest
environment: reports-updates # Uses the GitHub environment with secrets
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
pip install -r python/requirements.txt
- name: Run SNOMED Report Generator
working-directory: ./python
env:
SNOMED_USER: ${{ secrets.SNOMED_USER }}
SNOMED_PASSWORD: ${{ secrets.SNOMED_PASSWORD }}
run: |
python run-reports.py
- name: Check for changes
id: git-check
run: |
git diff --exit-code src/assets/reports/ || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit and push updated reports
if: steps.git-check.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add src/assets/reports/*.html
git diff --staged --quiet || git commit -m "🤖 Auto-update: SNOMED reports for $(date +'%Y-%m-%d')"
git push
- name: No changes detected
if: steps.git-check.outputs.changed != 'true'
run: |
echo "ℹ️ No changes detected in reports. Skipping commit."