Skip to content

couple more

couple more #695

name: Check derivatives change
on:
pull_request:
paths:
- "*.csv"
permissions:
contents: read
pull-requests: write
jobs:
checkDerivativesChange:
runs-on: ubuntu-latest
name: Fail if the PR contains incorrect derivative databases
steps:
- name: Checkout
uses: actions/[email protected]
- name: Check if the PR changes any of the derivative databases
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
*.csv
!plane-alert-db.csv
!plane-alert-pia.csv
!plane_images.csv
separator: ","
- uses: actions/[email protected]
if: steps.changed-files.outputs.any_changed == 'true'
with:
python-version: "3.10"
cache: "pip"
- if: steps.changed-files.outputs.any_changed == 'true'
run: pip install -r ./scripts/requirements.txt
- name: Run derivative databases creation script
if: steps.changed-files.outputs.any_changed == 'true'
run: python ./scripts/create_db_derivatives.py
- name: Run check invalid derivatives script
if: steps.changed-files.outputs.any_changed == 'true'
id: invalid_derivatives
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: python ./scripts/check_invalid_derivatives.py
- name: Store derivative check results as artifacts
run: |
mkdir -p ./check_derivatives_change
echo ${{ steps.changed-files.outputs.any_changed }} > ./check_derivatives_change/derivative_files_changed
echo ${{ github.event.number }} > ./check_derivatives_change/issue_number
- uses: actions/[email protected]
with:
name: check_derivatives_change
path: check_derivatives_change/
- name: Fail on incorrect changes
if: steps.changed-files.outputs.any_changed == 'true' && steps.invalid_derivatives.outputs.derivatives_changed == 'true'
run: |
echo "Derivative files changed and were different from the automatic generation pipeline."
exit 1
- name: Succeed on correct changes
if: steps.changed-files.outputs.any_changed == 'true' && steps.invalid_derivatives.outputs.derivatives_changed == 'false'
run: |
echo "Derivative files changed but were in line with the automatic generation pipeline."
- name: Succeed on no changes
if: steps.changed-files.outputs.any_changed == 'false'
run: |
echo "No derivative files were changed."