From a2ca93f7a441236e08e0620bf89f128a9f6b5034 Mon Sep 17 00:00:00 2001 From: Phil Asmar Date: Thu, 5 Dec 2024 09:13:31 -0500 Subject: [PATCH] chore: add workflow to check if change file is included in a PR --- .github/workflows/change-file-in-pr.yml | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/change-file-in-pr.yml diff --git a/.github/workflows/change-file-in-pr.yml b/.github/workflows/change-file-in-pr.yml new file mode 100644 index 0000000..911b7e7 --- /dev/null +++ b/.github/workflows/change-file-in-pr.yml @@ -0,0 +1,30 @@ +name: Change File Included in PR + +on: + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + check-files-in-directory: + if: ${{ !contains(github.event.pull_request.labels.*.name, 'Release Not Needed') && !contains(github.event.pull_request.labels.*.name, 'Release PR') }} + name: Change File Included in PR + runs-on: ubuntu-latest + + steps: + - name: Checkout PR code + uses: actions/checkout@v3 + + - name: Get List of Changed Files + id: changed-files + uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf #v45 + + - name: Check for Change File(s) in .autover/changes/ + run: | + DIRECTORY=".autover/changes/" + if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "$DIRECTORY"; then + echo "✅ One or more change files in '$DIRECTORY' are included in this PR." + else + echo "❌ No change files in '$DIRECTORY' are included in this PR." + echo "Refer to the 'Adding a change file to your contribution branch' section of https://github.com/aws/aws-logging-dotnet/blob/master/CONTRIBUTING.md" + exit 1 + fi