Skip to content

Commit

Permalink
switch to maxTries pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 15, 2023
1 parent 01370cf commit 6b021d6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,24 @@ jobs:
echo "Let's make sure this tag doesn't already exist..."
NEW_TAG="v1.1.0-pre1"
i=0
tries=0
maxTries=5
while [$i -lt 5] ; do
while true ; do
echo "i is $i"
RESPONSE=$(curl -sl https://api.github.com/repos/microsoft/CoseSignTool/releases/tags/$NEW_TAG)
echo "$RESPONSE" | jq -r '.message'
if [ "$(echo "$RESPONSE" | jq -r '.message')" == "Not Found" ]; then
echo "Tag not found. We're good to go."
break
else
if [ $tries -ge $maxTries ]; then
echo "Max tries reached. Exiting."
exit 1
fi
echo "Oops! That tag_TAG already exists!"
NEW_TAG="${NEW_TAG%-*}-pre$(( ${NEW_TAG##*-pre} + 1 ))" # Increment the prerelease number.
echo "Let's try $NEW_TAG"
((i++))
fi
done
Expand Down

0 comments on commit 6b021d6

Please sign in to comment.