Last active
November 5, 2021 20:44
-
-
Save bsnux/a3ea2d93f5e29dc07a7cf8a2317bd95c to your computer and use it in GitHub Desktop.
Download a release file from a private GitHub repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# How to download a release file from a private GitHub repo | |
set -eou pipefail | |
TOKEN="<your_github_token>" | |
API_URL="https://api.github.com/repos/<your_repo_here>" | |
asset_id=$(curl -s -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3.raw" $API_URL/releases \ | |
| jq '.[0].assets[0].id') | |
curl -s -L -H "Accept: application/octet-stream" -H "Authorization: token $TOKEN" $API_URL/releases/assets/$asset_id \ | |
--output <filename> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment