Skip to content

Commit d2e869b

Browse files
committed
Workflows: use gh API to get list of changed files
1 parent 5e8197e commit d2e869b

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

.github/workflows/eamxx-sa-testing.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ jobs:
6464
".github/workflows/eamxx-sa-testing.yml"
6565
)
6666
pattern=$(IFS=\|; echo "${paths[*]}")
67-
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
67+
68+
# Use the GitHub API to get the list of changed files
69+
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
70+
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}/files")
71+
72+
# Extract the filenames from the response
73+
changed_files=$(echo "$response" | jq -r '.[].filename')
74+
6875
if [[ $changed_files =~ ^($pattern) ]]; then
6976
echo "value=true" >> $GITHUB_OUTPUT
7077
else

.github/workflows/eamxx-scripts-tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ jobs:
4545
)
4646
4747
pattern=$(IFS=\|; echo "${paths[*]}")
48-
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
48+
49+
# Use the GitHub API to get the list of changed files
50+
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
51+
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}/files")
52+
53+
# Extract the filenames from the response
54+
changed_files=$(echo "$response" | jq -r '.[].filename')
55+
4956
if [[ $changed_files =~ ^($pattern) ]]; then
5057
echo "value=true" >> $GITHUB_OUTPUT
5158
else

.github/workflows/eamxx-v1-testing.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ jobs:
5757
".github/workflows/eamxx-v1-testing.yml"
5858
)
5959
pattern=$(IFS=\|; echo "${paths[*]}")
60-
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
60+
61+
# Use the GitHub API to get the list of changed files
62+
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
63+
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}/files")
64+
65+
# Extract the filenames from the response
66+
changed_files=$(echo "$response" | jq -r '.[].filename')
67+
6168
if [[ $changed_files =~ ^($pattern) ]]; then
6269
echo "value=true" >> $GITHUB_OUTPUT
6370
else

0 commit comments

Comments
 (0)