Skip to content

Instantly share code, notes, and snippets.

@raws
Last active December 30, 2015 05:19
Show Gist options
  • Save raws/7782024 to your computer and use it in GitHub Desktop.
Save raws/7782024 to your computer and use it in GitHub Desktop.
#!/bin/bash
access_token='...'
repo='...'
timestamp="$(date "+%s")"
github_api_request() {
local endpoint="https://api.github.com$1"
local file_name="$2"
curl -s \
-H "Authorization: token $access_token" \
-H 'Accept: application/vnd.github.beta+json' \
"$endpoint" \
| gzip -9 > "$(output_path "$file_name")"
}
output_path() {
local name="$1"
echo "$timestamp-$name.json.gz"
}
github_api_request "/repos/$repo/issues?state=open" open-issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment