Skip to content

Photos for 3EAD63, 3F5727, ADFCC6, AE1EA2, AE1F40, AE1F83, AE13AF, AE269E, AE61C6, & E84834 #317

Photos for 3EAD63, 3F5727, ADFCC6, AE1EA2, AE1F40, AE1F83, AE13AF, AE269E, AE61C6, & E84834

Photos for 3EAD63, 3F5727, ADFCC6, AE1EA2, AE1F40, AE1F83, AE13AF, AE269E, AE61C6, & E84834 #317

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@v3
- 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-alert-twitter-blocked.csv
!plane-alert-ukraine.csv
!plane_images.csv
separator: ","
- uses: actions/setup-python@v4
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@v3
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."