Skip to content

Commit 60af3ea

Browse files
committed
test
1 parent ee8dd90 commit 60af3ea

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tools/config.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,12 @@ function github_release_asset_id(){ # github_release_asset_id <repo-path> <relea
214214
local asset_id=""
215215

216216
while [[ "$page" -le 5 ]]; do
217-
local response=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/releases/$release_id/assets?per_page=100&page=$page"`
217+
local response=$(curl -sf -H "Authorization: token $GITHUB_TOKEN" \
218+
-H "Accept: application/vnd.github.v3.raw+json" \
219+
"https://api.github.com/repos/$repo_path/releases/$release_id/assets?per_page=100&page=$page") || {
220+
echo "Failed to fetch release assets from GitHub for $repo_path" >&2
221+
exit 1
222+
}
218223

219224
if [[ -z "$response" || "$response" == "[]" ]]; then
220225
break
@@ -227,13 +232,15 @@ function github_release_asset_id(){ # github_release_asset_id <repo-path> <relea
227232
local release_asset=`echo "$response" | jq --arg release_file "$release_file" -r '.[] | select(.name == $release_file) | .id'`
228233
if [ ! "$release_asset" == "" ] && [ ! "$release_asset" == "null" ]; then
229234
asset_id=$release_asset
230-
break
235+
echo "$asset_id"
236+
return 0
231237
fi
232238

233239
page=$((page+1))
234240
done
235241

236-
echo "$asset_id"
242+
echo "No asset found for $release_file" >&2
243+
return 1
237244
}
238245

239246
function github_release_asset_upload(){ # github_release_asset_upload <repo-path> <release-id> <release-file-name> <release-file-path>

0 commit comments

Comments
 (0)