Skip to content

Commit 7a532ba

Browse files
authored
[ci] Use pagination in mirror workflow to get all Selenium releases (#16605)
1 parent af9b20e commit 7a532ba

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/mirror-selenium-releases.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,26 @@ jobs:
1616
fetch-depth: 0
1717
- name: Read api.github.com and filter response
1818
run: |
19+
set -euo pipefail
1920
cd common/mirror
20-
export JQ_FILTER="[.[] | {tag_name: .tag_name, assets: [.assets[] | {browser_download_url: .browser_download_url} ] } ]"
21-
curl -H "Authorization: ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/SeleniumHQ/selenium/releases | jq "$JQ_FILTER" > selenium
21+
TOKEN="${{ secrets.GITHUB_TOKEN }}"
22+
JQ_FILTER='[.[] | {tag_name: .tag_name, assets: [.assets[] | {browser_download_url: .browser_download_url} ] } ]'
23+
page=1
24+
tmpfile="$(mktemp)"
25+
: > "$tmpfile"
26+
while :; do
27+
echo "Fetching SeleniumHQ/selenium releases page $page..."
28+
resp=$(curl -fsSL \
29+
-H "Authorization: token $TOKEN" \
30+
"https://api.github.com/repos/SeleniumHQ/selenium/releases?per_page=100&page=${page}")
31+
if [ "$(echo "$resp" | jq 'length')" -eq 0 ]; then
32+
break
33+
fi
34+
echo "$resp" | jq "$JQ_FILTER" >> "$tmpfile"
35+
page=$((page+1))
36+
done
37+
jq -s 'add' "$tmpfile" > selenium
38+
rm "$tmpfile"
2239
- name: Commit files
2340
id: git
2441
run: |

0 commit comments

Comments
 (0)