Skip to content

Commit 2551ba9

Browse files
committed
Update release.yml
1 parent ffc41a2 commit 2551ba9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,16 @@ jobs:
6161
- name: 'Get changed files for this commit'
6262
id: changed_files
6363
run: |
64-
if [[ "$GITHUB_EVENT_NAME" == "push" || "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
64+
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
65+
# For pull requests, get changed files from the PR
66+
gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files[].path' | grep -E '^(Apps/|Manifests/)' > changed_files.txt || true
67+
if [ ! -s changed_files.txt ]; then
68+
echo "No changed files detected." > changed_files.txt
69+
fi
70+
elif [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
71+
# For push events, use git diff
6572
git fetch origin ${{ github.event.before }}
66-
# Get all changed files (added, modified, deleted) in Apps/ and Manifests/ directories
67-
git diff --name-status ${{ github.event.before }} ${{ github.sha }} | grep -E '^[AMD]\s+(Apps/|Manifests/)' | awk '{print $2}' > changed_files.txt
68-
# If no files found, create empty file
73+
git diff --name-status ${{ github.event.before }} ${{ github.sha }} | grep -E '^[AMD]\s+(Apps/|Manifests/)' | awk '{print $2}' > changed_files.txt || true
6974
if [ ! -s changed_files.txt ]; then
7075
echo "No changed files detected." > changed_files.txt
7176
fi
@@ -74,6 +79,7 @@ jobs:
7479
fi
7580
env:
7681
GITHUB_EVENT_NAME: ${{ github.event_name }}
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7783

7884
- name: 'Get PR information'
7985
id: pr_info

0 commit comments

Comments
 (0)