Skip to content

Commit

Permalink
add action auth token to release check and check response status
Browse files Browse the repository at this point in the history
  • Loading branch information
wulfraem committed Nov 29, 2024
1 parent f2db8ad commit f932a65
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
22 changes: 19 additions & 3 deletions .github/actions/iota-rebase-sandbox/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,25 @@ runs:
PLATFORM="${{ inputs.platform }}"
echo "Looking for platform: $PLATFORM"
# Get download URL
DOWNLOAD_URL=$(curl "https://api.github.com/repos/iotaledger/iota/releases/latest" | \
jq -r --arg p "$PLATFORM" '.assets[] | select(.name | contains($p)) | .browser_download_url')
# Try to get latest releases with action's auth token (-> increased request limit)
CODE_AND_BODY=$(curl \
"https://api.github.com/repos/iotaledger/iota/releases/latest" \
-s \
-w "\n%{http_code}" \
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}")
CODE=$(tail -n1 <<< "$CODE_AND_BODY")
BODY=$(sed '$ d' <<< "$CODE_AND_BODY")
# Check response status
if [[ "$CODE" != 2** ]]
then
echo "IOTA release check failed with status $CODE"
echo "$BODY"
exit 1
fi
# Get download link for platform
DOWNLOAD_URL=$(jq -r --arg p "$PLATFORM" '.assets[] | select(.name | contains($p)) | .browser_download_url' <<< "$BODY")
# Download and extract
echo "Downloading from: $DOWNLOAD_URL"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ version = "1.0.0"
edition = "2021"

[dependencies]
anyhow = "1.0.62"
identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] }
iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" }
tokio = { version = "1", features = ["full"] }
anyhow = "1.0.62"
rand = "0.8.5"
tokio = { version = "1", features = ["full"] }
```

_main._<span></span>_rs_
Expand Down
4 changes: 2 additions & 2 deletions identity_iota/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ version = "1.0.0"
edition = "2021"

[dependencies]
anyhow = "1.0.62"
identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] }
iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" }
tokio = { version = "1", features = ["full"] }
anyhow = "1.0.62"
rand = "0.8.5"
tokio = { version = "1", features = ["full"] }
```

_main._<span></span>_rs_
Expand Down

0 comments on commit f932a65

Please sign in to comment.