datagen #72
This file contains hidden or 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
name: datagen | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
echo "setuptools<72" > constraints.txt | |
export PIP_CONSTRAINT=constraints.txt | |
python -m pip install --upgrade pip | |
pip install -r datagen/requirements.txt | |
- name: Data generation | |
working-directory: datagen | |
run: | | |
python data_generate.py | |
- name: Copy files to seeds | |
run: | | |
cp datagen/org_created_broken.csv seeds/org__created.csv | |
cp datagen/user_created_broken.csv seeds/user__created.csv | |
cp datagen/signed_in_broken.csv seeds/signed__in.csv | |
cp datagen/subscription_created_broken.csv seeds/subscription__created.csv | |
cp datagen/feature_used_broken.csv seeds/feature__used.csv | |
- name: Copy data to Postgres | |
working-directory: datagen | |
run: | | |
chmod +x data_to_postgres.sh | |
./data_to_postgres.sh | |
env: | |
PGHOST: ${{ secrets.PGHOST }} | |
PGUSER: ${{ secrets.PGUSER }} | |
PGPASSWORD: ${{ secrets.PGPASSWORD }} | |
- name: Configure Git | |
run: | | |
git config --global user.name 'datagen-bot' | |
git config --global user.email 'datagen-bot@users.noreply.github.com' | |
- name: Commit new files | |
run: | | |
rm constraints.txt | |
git add -A | |
git commit -m "New data obtained on $(date)" | |
- name: Push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push |