Skip to content

Add derivative warning #611

Add derivative warning

Add derivative warning #611

name: Add derivative warning
on:
workflow_run:
workflows: ["Check derivatives change"]
types:
- completed
permissions:
contents: read
pull-requests: write
jobs:
addDerivativeChangeWarning:
runs-on: ubuntu-latest
name: Add warning if derivative change was detected
if: github.event.workflow_run.event == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
- name: Download artifact
uses: dawidd6/action-download-artifact@v6
with:
name: check_derivatives_change
workflow: check_derivatives_change.yml
run_id: ${{github.event.workflow_run.id }}
- name: Retrieve derivative check result from artifacts
id: changed
run: |
derivative_files_changed=`cat derivative_files_changed`
echo "derivative_files_changed=${derivative_files_changed}" >> "${GITHUB_OUTPUT}"
issue_number=`cat issue_number`
echo "issue_number=${issue_number}" >> "${GITHUB_OUTPUT}"
- if: steps.changed.outputs.derivative_files_changed == 'true'
run: |
echo "WARNING_MSG<<EOF" >> $GITHUB_ENV
echo "$(cat READ_BEFORE_MAKING_CHANGES.md | tail -n +3)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Post derivative databases change warning
if: steps.changed.outputs.derivative_files_changed == 'true'
uses: thollander/actions-comment-pull-request@v3.0.0
with:
message: |
${{ env.WARNING_MSG }}
comment_tag: execution
pr_number: ${{ steps.changed.outputs.issue_number }}