Skip to content

Update US data

Update US data #1296

Workflow file for this run

name: Update US data
on:
schedule:
- cron: "0 10 * * *"
workflow_dispatch:
jobs:
update-us:
runs-on: ubuntu-latest
steps:
# Python & dependency installation
- uses: actions/checkout@v3
- name: Yaml file linting
run: |
docker run --rm \
-v $(pwd):/code \
registry.gitlab.com/pipeline-components/yamllint:latest \
-s .
- name: setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: install Poetry
uses: snok/[email protected]
- name: cache Poetry virtualenv
uses: actions/cache@v3
id: cache
with:
path: ~/.virtualenvs/
key: poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ hashFiles('**/poetry.lock') }}
- name: set poetry config path
run: poetry config virtualenvs.path ~/.virtualenvs
- name: install dependencies
run: poetry install
- name: people to database
run: poetry run os-us-to-yaml
env:
OS_PEOPLE_DIRECTORY: ${{ env.GITHUB_WORKSPACE }}
- name: update remote git repo if necessary
run: |-
git diff
git checkout -b "automatic-us-updates-$(date +%Y-%m-%d)"
git config --global user.email "[email protected]"
git config --global user.name "openstates-bot"
git add -A
git commit -m "automated US update" || exit 0
git push -u origin "automatic-us-updates-$(date +%Y-%m-%d)"
gh pr create -f
env:
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}