Skip to content

Commit

Permalink
build: resolve changes files via API instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Nov 17, 2024
1 parent e0790b9 commit 1983295
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/run_tests_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1983295

Please sign in to comment.