Skip to content

Commit a20c137

Browse files
author
u102348 (Per Westling)
committed
Avoid unnecessary curl
This commit will use curl to get the SHA for latest version of dagger, only if user has requested to use 'latest' version. If requesting a specific version the curl call is avoided. This will help to alleviate issue with Error 429 if using a specific dagger-for-github version. Signed-off-by: u102348 (Per Westling) <per.westling1@saabgroup.com>
1 parent 074302d commit a20c137

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,18 @@ runs:
8888
# Add 'v' prefix if version doesn't start with 'v' and is not empty
8989
VERSION="v$VERSION"
9090
fi
91-
latest=$(curl https://dl.dagger.io/dagger/versions/latest)
9291
9392
COMMIT=${{ inputs.commit }}
9493
9594
if [[ -x "$(command -v dagger)" ]]; then
9695
echo "::group::Checking dagger"
9796
version="$(dagger --silent version | cut --fields 2 --delimiter ' ')"
9897
echo "Found existing dagger version: $version"
99-
if [[ "$version" == "$VERSION" ]] || [[ "$version" == "$latest" ]]; then
98+
if [[ -z "$VERSION" ]]; then
99+
latest=$(curl -s https://dl.dagger.io/dagger/versions/latest)
100+
fi
101+
if [[ "$version" == "$VERSION" ]] || \
102+
[[ -z "$VERSION" && "$version" == "$latest" ]]; then
100103
echo "dagger ${version} is already installed, skipping installation"
101104
exit 0
102105
fi

0 commit comments

Comments
 (0)