Update recent tally #1
This file contains 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
# .github/workflows/update_recent_tally.yml | |
name: Update recent tally | |
on: | |
schedule: | |
- cron: '25 6 * * 5' | |
jobs: | |
generate-tally: | |
name: Generate recent tally | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Dependencies | |
run: | | |
pip install uv | |
uv venv | |
source .venv/bin/activate | |
uv pip install -r requirements.txt | |
- name: Tally recent cartons per state | |
run: | | |
source .venv/bin/activate | |
python3 scripts/positivity_tally.py \ | |
DETECTION_RESULTS.tsv \ | |
-d 90 \ | |
assets/recent_tally.tsv | |
- name: Commit recent tally | |
if: success() | |
run: | | |
git config --global user.name 'GitHub Actions Bot' | |
git config --global user.email '[email protected]' | |
git add assets/recent_tally.tsv | |
git fetch origin proposals | |
git commit -m "Updating recent tally" | |
git push --force-with-lease origin HEAD:proposals | |
render-readme: | |
name: Render new README | |
needs: generate-tally | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Pull latest changes from proposals | |
run: | | |
git fetch origin proposals | |
git pull origin proposals | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Dependencies | |
run: | | |
pip install uv | |
uv venv | |
source .venv/bin/activate | |
uv pip install -r requirements.txt | |
- name: Generate Markdown Table | |
run: | | |
source .venv/bin/activate | |
python3 scripts/tsv_to_md.py \ | |
assets/recent_tally.tsv \ | |
> assets/recent_tally.md | |
- name: Splice Table into README | |
run: | | |
source .venv/bin/activate | |
python3 scripts/splice_recent.py | |
- name: Replace previous README | |
run: | | |
rm README.md && \ | |
mv new_readme.md README.md | |
- name: Commit Updated README | |
if: success() | |
run: | | |
git config --global user.name 'GitHub Actions Bot' | |
git config --global user.email '[email protected]' | |
git add README.md | |
git fetch origin proposals | |
git commit -m "Updated the README file" | |
git push --force-with-lease origin HEAD:proposals |