Skip to content

Commit 1983295

Browse files
committed
build: resolve changes files via API instead
1 parent e0790b9 commit 1983295

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/run_tests_coverage.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,22 @@ jobs:
131131
if: github.event_name != 'workflow_dispatch'
132132
id: changed-directories
133133
continue-on-error: true
134+
env:
135+
STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
134136
run: |
135137
if [ -n "${{ github.event.pull_request.number }}" ]; then
136138
# Get the list of changed files in pull request:
137-
ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
138-
files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }})
139+
page=1
140+
files=""
141+
while true; do
142+
changed_files=$(curl -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer $STDLIB_BOT_GITHUB_TOKEN" "https://api.github.com/repos/stdlib-js/stdlib/pulls/${{ github.event.pull_request.number }}/files?page=$page&per_page=100" | jq -r '.[] | .filename')
143+
if [ -z "$changed_files" ]; then
144+
break
145+
fi
146+
files="$files $changed_files"
147+
page=$((page+1))
148+
done
149+
files=$(echo "$files" | tr '\n' ' ' | sed 's/ $//')
139150
else
140151
# Get changed files by comparing the current commit to the commit before the push event or with its parent:
141152
if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then

0 commit comments

Comments
 (0)