1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

Use the same logic to retreive the commit date

This commit is contained in:
Valentin Brandl 2024-03-16 17:11:55 +01:00
parent 432b69499e
commit 42361fd8d9
No known key found for this signature in database
GPG key ID: CAD4DA1A789125F9

View file

@ -21,14 +21,11 @@ rev="$1"
set -euo pipefail
if [ -z "$rev" ]; then
response="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/jpochyla/psst/commits?per_page=1")"
rev="$(jq -r '.[0].sha' <<< "$response")"
date="$(jq -r '.[0].commit.author.date' <<< "$response" | cut -dT -f1)"
else
response="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/jpochyla/psst/commits/$rev")"
date="$(jq -r '.commit.author.date' <<< "$response" | cut -dT -f1)"
rev="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/jpochyla/psst/commits?per_page=1" | jq -r '.[0].sha')"
fi
date="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/jpochyla/psst/commits/$rev" | jq -r '.commit.author.date' | cut -dT -f1)"
version="unstable-$date"
# Sources