thru 12sep #663
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: 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/checkout@v4.1.7 | |
- name: Check if the PR changes any of the derivative databases | |
id: changed-files | |
uses: tj-actions/changed-files@v45.0.1 | |
with: | |
files: | | |
*.csv | |
!plane-alert-db.csv | |
!plane-alert-pia.csv | |
!plane-alert-ukraine.csv | |
!plane_images.csv | |
separator: "," | |
- uses: actions/setup-python@v5.2.0 | |
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/upload-artifact@v4.4.0 | |
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." |