File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 # List paths for which changes should trigger this workflow:
2727 - ' lib/**/benchmark/**'
2828
29- pull_request_target :
29+ pull_request :
3030 types :
3131 - opened
3232 - synchronize
5353 - name : ' Checkout repository'
5454 uses : actions/checkout@v3
5555 with :
56+
5657 # Specify whether to remove untracked files before checking out the repository:
5758 clean : true
5859
Original file line number Diff line number Diff line change 2727 - ' lib/**/examples/**'
2828 - ' lib/**/README.md'
2929
30- pull_request_target :
30+ pull_request :
3131 types :
3232 - opened
3333 - synchronize
8989 id : changed-files
9090 run : |
9191 if [ -n "${{ github.event.pull_request.number }}" ]; then
92- # Get the list of changed files in pull request via the GitHub API:
93- page=1
94- files=""
95- while true; do
96- new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.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 '.[] | select(.status == "modified" or .status == "added") | .filename')
97- if [ -z "$new_files" ]; then
98- break
99- fi
100- files="$files $new_files"
101- page=$((page+1))
102- done
92+ # Get the list of changed files in pull request:
93+ ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
94+ files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }})
10395 else
10496 # Get changed files by comparing the current commit to the commit before the push event or with its parent:
10597 if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
Original file line number Diff line number Diff line change 4141 # List paths for which changes should *not* trigger this workflow:
4242 - ' !lib/**/_tools/**'
4343
44- pull_request_target :
44+ pull_request :
4545 types :
4646 - opened
4747 - synchronize
@@ -123,17 +123,9 @@ jobs:
123123 id : changed-directories
124124 run : |
125125 if [ -n "${{ github.event.pull_request.number }}" ]; then
126- # Get the list of changed files in pull request via the GitHub API:
127- page=1
128- files=""
129- while true; do
130- new_files=$(curl -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.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 '.[] | select(.status == "modified" or .status == "added") | .filename')
131- if [ -z "$new_files" ]; then
132- break
133- fi
134- files="$files $new_files"
135- page=$((page+1))
136- done
126+ # Get the list of changed files in pull request:
127+ ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
128+ files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }})
137129 else
138130 # Get changed files by comparing the current commit to the commit before the push event or with its parent:
139131 if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
You can’t perform that action at this time.
0 commit comments