Skip to content

Commit c007698

Browse files
committed
Switch to consuming JSON from GitHub for "latest commit touching file"
For some reason, https://github.com/xxx/yyy/commits/HEAD/zzz.atom has recently changed from returning XML by default to returning JSON, which from https://docs.github.com/en/rest/activity/feeds?apiVersion=2022-11-28 seems like it's intentional, so this adds an explicit `Accept:` header (the only explicit JSON one that seems to work) and uses `jq` to determine the latest commit instead of hacking up the XML via `grep`+`awk`. See also docker-library/docker#472 (Additionally, this switches the file to use `wget` consistently instead of a mix of `wget` and `curl`)
1 parent 45ac1ec commit c007698

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

versions.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ else
1717
fi
1818
versions=( "${versions[@]%/}" )
1919

20-
getPipCommit="$(curl -fsSL 'https://github.com/pypa/get-pip/commits/main/public/get-pip.py.atom' | grep -E 'id.*Commit')"
21-
getPipCommit="$(awk <<<"$getPipCommit" -F '[[:space:]]*[<>/]+' '$2 == "id" && $3 ~ /Commit/ { print $4; exit }')"
20+
getPipCommit="$(
21+
wget -qO- --header 'Accept: application/json' 'https://github.com/pypa/get-pip/commits/main/public/get-pip.py.atom' \
22+
| jq -r '.payload | first(.commitGroups[].commits[].oid)'
23+
)"
2224
getPipUrl="https://github.com/pypa/get-pip/raw/$getPipCommit/public/get-pip.py"
23-
getPipSha256="$(curl -fsSL "$getPipUrl" | sha256sum | cut -d' ' -f1)"
25+
getPipSha256="$(wget -qO- "$getPipUrl" | sha256sum | cut -d' ' -f1)"
2426
export getPipCommit getPipUrl getPipSha256
2527

2628
has_linux_version() {
@@ -64,7 +66,7 @@ for version in "${versions[@]}"; do
6466
|| :
6567
6668
# this page has a very aggressive varnish cache in front of it, which is why we also scrape tags from GitHub
67-
curl -fsSL 'https://www.python.org/ftp/python/' \
69+
wget -qO- 'https://www.python.org/ftp/python/' \
6870
| grep '<a href="'"$rcVersion." \
6971
| sed -r 's!.*<a href="([^"/]+)/?".*!\1!' \
7072
| grep $rcGrepV -E -- '[a-zA-Z]+' \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy