Unverified Commit 42361fd8 authored by Valentin Brandl's avatar Valentin Brandl
Browse files

Use the same logic to retreive the commit date

parent 432b6949
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -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