fix: lib: use temporary unique file name

The function may be called from scripts that run under different users
and re-using the same file name will run into problems:

/home/debian/.cache/act/2cc577985400de79/hostexecutor/lib/lib.sh: line 96: /tmp/page: Permission denied
curl: (23) Failure writing output to destination
This commit is contained in:
limiting-factor 2025-02-23 13:57:36 +01:00
parent 327386d195
commit e03278e4c1

View file

@ -92,10 +92,11 @@ function retry() {
function get_versions() {
local releases=$1
local page=1
local tmp=$(mktemp)
while true; do
curl --fail -sS "$releases?limit=100&page=$page" | jq -r '.[] | .tag_name' >/tmp/page
cat /tmp/page
if ! test -s /tmp/page; then
curl --fail -sS "$releases?limit=100&page=$page" | jq -r '.[] | .tag_name' >$tmp
cat $tmp
if ! test -s $tmp; then
break
fi
page=$(expr $page + 1)