Skip to content

Database Update

Database Update #2

Workflow file for this run

name: Database Update
on:
# push:
# branches: development
schedule:
# Runs at midnight every Wednesday
- cron: '0 0 * * 3'
jobs:
update-database:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
repository: 'euanwm/OpenWeightlifting'
ref: 'development' # Check out the development branch
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies from pipfile
run: |
cd python_tools
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
- name: Run backend_cli.py
run: |
cd python_tools
python -m pip install --upgrade pip
pip install pipenv
pipenv run python backend_cli.py --update all
- name: Run check_db.py
run: |
cd python_tools
pip install pipenv
pipenv run python check_db.py
- name: Commit and push if there are changes
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git checkout -b db/auto-update
git add .
git commit -m "Database Update" -m "Action run on $(date)" || echo "No changes to commit"
git push
- name: Open a pull request
if: always() # will PR everytime this is run, delete or comment it out if you want to remove it.
uses: repo-sync/pull-request@v2
with:
source_branch: 'db/auto_update'
destination_branch: 'development' # PR within the same branch
pr_title: 'Database Update Review'
pr_body: 'Automated database update for review.'
github_token: ${{ secrets.GITHUB_TOKEN }}