From 398559b17b593d5c6ffe21457d5fa4ab6c7de670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96=2E=20Efe=20D=2E?= <67526259+skyline69@users.noreply.github.com> Date: Wed, 26 Mar 2025 00:34:41 +0100 Subject: [PATCH] Update mod validation Use PAT token. --- .github/workflows/check-mod.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-mod.yml b/.github/workflows/check-mod.yml index 48583a0e..2a2c102d 100644 --- a/.github/workflows/check-mod.yml +++ b/.github/workflows/check-mod.yml @@ -22,12 +22,15 @@ jobs: - name: Identify Changed Mods id: find-changed-mods run: | - # Fetch the base branch of the PR - git fetch origin ${{ github.event.pull_request.base.ref }} + # Get the list of files changed in the PR using GitHub API with PAT + FILES_CHANGED=$(curl -s -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" \ + | jq -r '.[].filename') - # Find all added or modified files in mods directory - git diff --name-only --diff-filter=AM origin/${{ github.event.pull_request.base.ref }}..HEAD | grep -E '^mods/[^/]+/' | cut -d'/' -f1-2 | sort | uniq > changed_mods.txt + # Filter for mod files and extract mod directories + echo "$FILES_CHANGED" | grep -E '^mods/[^/]+/' | cut -d'/' -f1-2 | sort | uniq > changed_mods.txt + # Check if any mods were found if [ ! -s changed_mods.txt ]; then echo "No mods were added or modified in this PR." echo "changed_mods_found=false" >> $GITHUB_OUTPUT