From 1983295710ec99e791ba206297b9e2f109264456 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sun, 17 Nov 2024 15:25:24 -0500 Subject: [PATCH] build: resolve changes files via API instead --- .github/workflows/run_tests_coverage.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_coverage.yml b/.github/workflows/run_tests_coverage.yml index a48ddd81d3eb..4fba596883e2 100644 --- a/.github/workflows/run_tests_coverage.yml +++ b/.github/workflows/run_tests_coverage.yml @@ -131,11 +131,22 @@ jobs: if: github.event_name != 'workflow_dispatch' id: changed-directories continue-on-error: true + env: + STDLIB_BOT_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} run: | if [ -n "${{ github.event.pull_request.number }}" ]; then # Get the list of changed files in pull request: - ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) - files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }}) + page=1 + files="" + while true; do + 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') + if [ -z "$changed_files" ]; then + break + fi + files="$files $changed_files" + page=$((page+1)) + done + files=$(echo "$files" | tr '\n' ' ' | sed 's/ $//') else # Get changed files by comparing the current commit to the commit before the push event or with its parent: if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then