Add check that database is up to date in CI #33
Workflow file for this run
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
name: Add comment to PRs displaying changes to the database | |
on: | |
pull_request: | |
jobs: | |
add-database-changes-comment-to-pr: | |
if: ${{ !github.event.pull_request.draft }} | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
env: | |
BODY_FILE: "database-changes-comment.md" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Create comment | |
env: | |
COMMIT_ID: ${{ github.event.pull_request.head.sha }} | |
run: | | |
which pip | |
pip install python-packages/input4MIPs-CVs | |
python python-packages/input4MIPs-CVs/src/input4MIPs_CVs/cli/create-database-diff-comment.py --current-db Database/input4MIPs_db_file_entries.json --out-file $BODY_FILE --commit-id $COMMIT_ID | |
# # Turn on for debugging | |
# cat $BODY_FILE | |
- name: Add comment | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: gh pr comment "$PR_NUMBER" --body-file "$BODY_FILE" | |
check-database-up-to-date: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Check database up to date | |
run: | | |
which pip | |
pip install python-packages/input4MIPs-CVs | |
python python-packages/input4MIPs-CVs/src/input4MIPs_CVs/cli/update-database.py --root-dir . || echo "Database entries not up to date with inputs. Please run `python python-packages/input4MIPs-CVs/src/input4MIPs_CVs/cli/update-database.py --root-dir .` or the equivalent for your machine." && exit 1 |