.github/workflows/data.yml #3045
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
on: | |
workflow_dispatch: | |
schedule: | |
# https://github.com/opensanctions/opensanctions/blob/main/.github/workflows/production.yml#L5 | |
- cron: "0 2,8,14,20 * * *" | |
jobs: | |
build-data: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: ftm | |
POSTGRES_PASSWORD: ftm | |
POSTGRES_USER: ftm | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
FTM_STORE_URI: postgresql://ftm:ftm@localhost/ftm | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
- name: Install apt dependencies | |
run: | | |
sudo apt-get update --yes | |
sudo apt-get install --yes postgresql-client curl libicu-dev | |
- name: Install pip packages | |
run: pip install "SQLAlchemy<2" followthemoney followthemoney-store psycopg2-binary pandas pyicu | |
- name: Download and import latest data | |
run: curl -s https://data.opensanctions.org/datasets/latest/all/entities.ftm.json?`date '+%s'` | ftm store write -d opensanctions | |
- name: wrangle data | |
run: python3 ./build_data.py | |
- name: Commit and push | |
uses: github-actions-x/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push-branch: 'main' | |
commit-message: ':robot: automatic data build' | |
rebase: true | |
name: 'github action' | |
files: src/data/ |