From e03278e4c1873a86028f94b26dbf13c2131a334f Mon Sep 17 00:00:00 2001 From: limiting-factor Date: Sun, 23 Feb 2025 13:57:36 +0100 Subject: [PATCH] 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 --- lib/lib.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/lib.sh b/lib/lib.sh index 96650b89..f752ec00 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -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)