From 4ce37fa8a3288105058e76ba1ba62981545de31a Mon Sep 17 00:00:00 2001 From: "Daniel W. Anner" Date: Thu, 27 Jul 2023 14:17:58 -0400 Subject: [PATCH] Pickle Action Tasks (#1500) * adding test for pickle * adding a PR comment if the file is modified * Adding a step to add the appropriate labels * Adding action to remove label if pickle is not modified * adding newline to fix formatting --- .github/workflows/validation.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 6293364d9..ab8ddb851 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -62,6 +62,8 @@ jobs: test: runs-on: ubuntu-latest needs: [lint, format] + permissions: + pull-requests: write steps: - uses: actions/checkout@v3 - name: Setup Python @@ -87,3 +89,28 @@ jobs: - name: Run Test Cases id: pytest run: pytest --tb=short -v + - name: Check for pickle file change + id: pickle-change + uses: tj-actions/changed-files@v37 + with: + files: 'tests/known-slugs.pickle' + - name: Add PR Comment if pickle file is modified + uses: mshick/add-pr-comment@v2 + if: steps.pickle-change.outputs.any_changed == 'true' + with: + message: | + Hello, it appears that you have modified the `tests/known-slugs.pickle` file. This file is automatically generated via a GitHub Action, which contains all currently available slugs. This file should **never** be commited by a contributor in a PR. + + In order to fix this, you will need to remove the modification on the pickle file. There are a handful of ways to do so but often it is easiest to revert the commit and force push it again without the pickle file included. If you need assistance you are welcome to ping a maintainer via this PR, or via our NetDev Slack. + - name: Add Labels if pickle file is modified + uses: actions-ecosystem/action-add-labels@v1 + if: steps.pickle-change.outputs.any_changed == 'true' + with: + labels: | + status: revisions needed + status: pickle-issue + - uses: actions-ecosystem/action-remove-labels@v1 + if: steps.pickle-change.outputs.any_changed != 'true' + with: + labels: | + status: pickle-issue