Skip to content

Fix FDA24

Fix FDA24 #394

Workflow file for this run

name: Autofill & Build
on:
pull_request_target:
branches: [ master ]
jobs:
autofill_and_build:
runs-on: ubuntu-latest
services:
covid-drdb-devdb:
image: postgres:latest
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout payload repository
uses: actions/checkout@v3
with:
path: covid-drdb-payload
- name: Checkout covid-drdb repository
uses: actions/checkout@v3
with:
repository: hivdb/covid-drdb
path: covid-drdb
- name: Checkout PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd covid-drdb-payload
gh pr checkout ${{ github.event.pull_request.number }}
- name: Run autofill-payload
run: |
set -e
cd covid-drdb
docker run --rm -v $GITHUB_WORKSPACE/covid-drdb:/covid-drdb -v $GITHUB_WORKSPACE/covid-drdb-payload:/covid-drdb-payload hivdb/covid-drdb-builder:latest pipenv run python -m drdb.entry autofill-payload /covid-drdb-payload
- name: Validate the results
env:
POSTGRES_PORT: 5432
POSTGRES_HOST: localhost
run: |
set -e
cd covid-drdb
mkdir -p local/sqls
docker run --rm -v="$(pwd)":/covid-drdb/ -v="$(dirname $(pwd))"/covid-drdb-payload:/covid-drdb/payload hivdb/covid-drdb-builder:latest scripts/export-sqls.sh
psql -v ON_ERROR_STOP=1 -U postgres -h localhost -f local/sqls/01_schema.sql
psql -v ON_ERROR_STOP=1 -U postgres -h localhost -f local/sqls/02_data_tables.sql
psql -v ON_ERROR_STOP=1 -U postgres -h localhost -f local/sqls/03_derived_tables.sql
- name: Check for changes and commit
run: |
git config --global user.name "HIVDB Bot"
git config --global user.email "[email protected]"
cd covid-drdb-payload
git add .
git diff --cached --quiet || git commit -m "Autogenerated data updated by HIVDB Bot"
echo "committed=$?" >> $GITHUB_ENV
- name: Push changes
if: env.committed == 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
cd covid-drdb-payload
git remote add headrepo https://${GITHUB_TOKEN}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git
git push headrepo ${{ github.event.pull_request.head.ref }}
gh pr edit ${{ github.event.pull_request.number }} --add-label "autofilled"