Skip to content

Instantly share code, notes, and snippets.

@relwell
Last active November 16, 2017 19:52
Show Gist options
  • Save relwell/54cec84773628e439b552d70629492bd to your computer and use it in GitHub Desktop.
Save relwell/54cec84773628e439b552d70629492bd to your computer and use it in GitHub Desktop.
##################################
# via git+https://
##################################
git clone https://${HARDCODED_ACCESS_TOKEN}:[email protected]/212595461/private_test.git
##################################
# Retrieving a single raw file
##################################
curl --header 'Authorization: token ${HARDCODED_ACCESS_TOKEN}’ --header 'Accept: application/vnd.github.v3.raw' --location 'https://github.build.ge.com/raw/212595461/private_test/master/README.md'
###################################
# Retrieving a Release Artifact
# Much trickier; requires two steps
###################################
#############################################################################
# 1) Identify The Assets Associated with the Release
#############################################################################
curl https://github.build.ge.com/api/v3/repos/212595461/private_test/releases/tags/1.0?access_token=${HARDCODED_ACCESS_TOKEN}
{
"url": "https://github.build.ge.com/api/v3/repos/212595461/private_test/releases/17680",
"assets_url": "https://github.build.ge.com/api/v3/repos/212595461/private_test/releases/17680/assets",
"upload_url": "https://github.build.ge.com/api/uploads/repos/212595461/private_test/releases/17680/assets{?name,label}",
"html_url": "https://github.build.ge.com/212595461/private_test/releases/tag/1.0",
"id": 17680,
"tag_name": "1.0",
"target_commitish": "master",
"name": "foo",
"draft": false,
"author": {
"login": "212595461",
"id": 18034,
"avatar_url": "https://github.build.ge.com/avatars/u/18034?",
"gravatar_id": "",
"url": "https://github.build.ge.com/api/v3/users/212595461",
"html_url": "https://github.build.ge.com/212595461",
"followers_url": "https://github.build.ge.com/api/v3/users/212595461/followers",
"following_url": "https://github.build.ge.com/api/v3/users/212595461/following{/other_user}",
"gists_url": "https://github.build.ge.com/api/v3/users/212595461/gists{/gist_id}",
"starred_url": "https://github.build.ge.com/api/v3/users/212595461/starred{/owner}{/repo}",
"subscriptions_url": "https://github.build.ge.com/api/v3/users/212595461/subscriptions",
"organizations_url": "https://github.build.ge.com/api/v3/users/212595461/orgs",
"repos_url": "https://github.build.ge.com/api/v3/users/212595461/repos",
"events_url": "https://github.build.ge.com/api/v3/users/212595461/events{/privacy}",
"received_events_url": "https://github.build.ge.com/api/v3/users/212595461/received_events",
"type": "User",
"site_admin": false
},
"prerelease": false,
"created_at": "2017-11-16T19:06:01Z",
"published_at": "2017-11-16T19:07:14Z",
"assets": [
{
"url": "https://github.build.ge.com/api/v3/repos/212595461/private_test/releases/assets/8147",
"id": 8147,
"name": "logo_blue.png",
"label": null,
"uploader": {
"login": "212595461",
"id": 18034,
"avatar_url": "https://github.build.ge.com/avatars/u/18034?",
"gravatar_id": "",
"url": "https://github.build.ge.com/api/v3/users/212595461",
"html_url": "https://github.build.ge.com/212595461",
"followers_url": "https://github.build.ge.com/api/v3/users/212595461/followers",
"following_url": "https://github.build.ge.com/api/v3/users/212595461/following{/other_user}",
"gists_url": "https://github.build.ge.com/api/v3/users/212595461/gists{/gist_id}",
"starred_url": "https://github.build.ge.com/api/v3/users/212595461/starred{/owner}{/repo}",
"subscriptions_url": "https://github.build.ge.com/api/v3/users/212595461/subscriptions",
"organizations_url": "https://github.build.ge.com/api/v3/users/212595461/orgs",
"repos_url": "https://github.build.ge.com/api/v3/users/212595461/repos",
"events_url": "https://github.build.ge.com/api/v3/users/212595461/events{/privacy}",
"received_events_url": "https://github.build.ge.com/api/v3/users/212595461/received_events",
"type": "User",
"site_admin": false
},
"content_type": "image/png",
"state": "uploaded",
"size": 6397,
"download_count": 2,
"created_at": "2017-11-16T19:07:14Z",
"updated_at": "2017-11-16T19:07:14Z",
"browser_download_url": "https://github.build.ge.com/212595461/private_test/releases/download/1.0/logo_blue.png"
},
{
"url": "https://github.build.ge.com/api/v3/repos/212595461/private_test/releases/assets/8150",
"id": 8150,
"name": "private_test.tar.gz",
"label": null,
"uploader": {
"login": "212595461",
"id": 18034,
"avatar_url": "https://github.build.ge.com/avatars/u/18034?",
"gravatar_id": "",
"url": "https://github.build.ge.com/api/v3/users/212595461",
"html_url": "https://github.build.ge.com/212595461",
"followers_url": "https://github.build.ge.com/api/v3/users/212595461/followers",
"following_url": "https://github.build.ge.com/api/v3/users/212595461/following{/other_user}",
"gists_url": "https://github.build.ge.com/api/v3/users/212595461/gists{/gist_id}",
"starred_url": "https://github.build.ge.com/api/v3/users/212595461/starred{/owner}{/repo}",
"subscriptions_url": "https://github.build.ge.com/api/v3/users/212595461/subscriptions",
"organizations_url": "https://github.build.ge.com/api/v3/users/212595461/orgs",
"repos_url": "https://github.build.ge.com/api/v3/users/212595461/repos",
"events_url": "https://github.build.ge.com/api/v3/users/212595461/events{/privacy}",
"received_events_url": "https://github.build.ge.com/api/v3/users/212595461/received_events",
"type": "User",
"site_admin": false
},
"content_type": "application/x-gzip",
"state": "uploaded",
"size": 379,
"download_count": 0,
"created_at": "2017-11-16T19:52:16Z",
"updated_at": "2017-11-16T19:52:16Z",
"browser_download_url": "https://github.build.ge.com/212595461/private_test/releases/download/1.0/private_test.tar.gz"
}
],
"tarball_url": "https://github.build.ge.com/api/v3/repos/212595461/private_test/tarball/1.0",
"zipball_url": "https://github.build.ge.com/api/v3/repos/212595461/private_test/zipball/1.0",
"body": "foo"
}
#############################################################################
# 2: Identify the appropriate file by name, and use its asset URL to download
#############################################################################
curl -vLJO -H 'Accept: application/octet-stream' https://github.build.ge.com/api/v3/repos/212595461/private_test/releases/assets/8150?access_token=${HARDCODED_ACCESS_TOKEN}
...
curl: Saved to filename 'private_test.tar.gz'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment