1
0

Update mod validation

Use PAT token.
This commit is contained in:
Ö. Efe D.
2025-03-26 00:34:41 +01:00
parent 943a4c49f3
commit 398559b17b

View File

@@ -22,12 +22,15 @@ jobs:
- name: Identify Changed Mods - name: Identify Changed Mods
id: find-changed-mods id: find-changed-mods
run: | run: |
# Fetch the base branch of the PR # Get the list of files changed in the PR using GitHub API with PAT
git fetch origin ${{ github.event.pull_request.base.ref }} 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 # Filter for mod files and extract mod directories
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 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 if [ ! -s changed_mods.txt ]; then
echo "No mods were added or modified in this PR." echo "No mods were added or modified in this PR."
echo "changed_mods_found=false" >> $GITHUB_OUTPUT echo "changed_mods_found=false" >> $GITHUB_OUTPUT