File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,10 +21,21 @@ jobs:
2121 env :
2222 GH_TOKEN : ${{ github.token }}
2323 run : |
24- LATEST_TAG_NAME =$(gh api repos/trufflesecurity/trufflehog/releases --jq '.[1].tag_name')
24+ RELEASES =$(gh api repos/trufflesecurity/trufflehog/releases --jq '.[1:3][ ].tag_name')
2525
26- if [[ -z "$LATEST_TAG_NAME" || "$LATEST_TAG_NAME" == "null" ]]; then
27- echo "::error::Failed to fetch TruffleHog release info"
26+ LATEST_TAG_NAME=""
27+ for tag in $RELEASES; do
28+ version="${tag#v}"
29+ url="https://github.com/trufflesecurity/trufflehog/releases/download/${tag}/trufflehog_${version}_linux_amd64.tar.gz"
30+ if curl --head --fail --silent --show-error --retry 2 --retry-delay 3 --retry-all-errors "$url" > /dev/null 2>&1; then
31+ LATEST_TAG_NAME="$tag"
32+ break
33+ fi
34+ echo "::warning::Release ${tag} assets unavailable, trying next"
35+ done
36+
37+ if [[ -z "$LATEST_TAG_NAME" ]]; then
38+ echo "::error::No usable TruffleHog release found"
2839 exit 1
2940 fi
3041
You can’t perform that action at this time.
0 commit comments