From d1e19abc63056117a123f51052e6c5084d2bd9e6 Mon Sep 17 00:00:00 2001 From: rickstaa Date: Sat, 4 Mar 2023 18:28:37 +0100 Subject: [PATCH] ci: add derivative warning action This commit adds a new github action that comments a warning to pull requests in which users try to change derivative databases. --- .github/workflows/create_db_derivatives.yaml | 2 +- .github/workflows/post_derivative_warning.yml | 31 +++++++++++++++++++ READ_BEFORE_MAKING_CHANGES.md | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/post_derivative_warning.yml diff --git a/.github/workflows/create_db_derivatives.yaml b/.github/workflows/create_db_derivatives.yaml index 01c04722..516c1cc5 100644 --- a/.github/workflows/create_db_derivatives.yaml +++ b/.github/workflows/create_db_derivatives.yaml @@ -1,4 +1,4 @@ -name: Create and commit category, images and extended database files +name: Create derivative databases on: push: diff --git a/.github/workflows/post_derivative_warning.yml b/.github/workflows/post_derivative_warning.yml new file mode 100644 index 00000000..84c649db --- /dev/null +++ b/.github/workflows/post_derivative_warning.yml @@ -0,0 +1,31 @@ +name: Post derivative warning + +on: + pull_request: + paths: + - "*.csv" + - "!plane-alert-db.csv" + - "!plane-alert-pia.csv" + - "!plane-alert-twitter-blocked.csv" + - "!plane-alert-ukraine.csv" + +jobs: + postDerivativeWarning: + runs-on: ubuntu-latest + name: Post a warning pull request comment when a user changes a derivative file + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Retrieve warning message from READ_BEFORE_MAKING_CHANGES.md + run: | + echo "WARNING_MSG<> $GITHUB_ENV + echo "$(cat READ_BEFORE_MAKING_CHANGES.md | tail -n +3)" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Post derivative warning + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + ${{ env.WARNING_MSG }} + comment_tag: execution diff --git a/READ_BEFORE_MAKING_CHANGES.md b/READ_BEFORE_MAKING_CHANGES.md index f3d23578..c62c2cf9 100644 --- a/READ_BEFORE_MAKING_CHANGES.md +++ b/READ_BEFORE_MAKING_CHANGES.md @@ -3,8 +3,8 @@ Please only suggest/make any changes to the following files: - [plane-alert-db.csv](plane-alert-db.csv): This is the main database file. All non-image changes should be done here. -- [plane-alert-twitter-blocked.csv](plane-alert-twitter-blocked.txt): This source file contains planes that will cause your Twitter account to be banned. Please use it with care. - [plane-alert-pia.csv](plane-alert-pia.csv): This list contains PIA planes. +- [plane-alert-twitter-blocked.csv](plane-alert-twitter-blocked.txt): This source file contains planes that will cause your Twitter account to be banned. Please use it with care. - [plane-alert-ukraine.csv](plane-alert-ukraine.csv): This list contains Ukrainian planes. - [plane_images.txt](plane_images.txt): You can add plane images in this source file.