Skip to content

Instantly share code, notes, and snippets.

@finestructure
Created August 28, 2019 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finestructure/8eeda2cb5539f89e268e895c91f99cf8 to your computer and use it in GitHub Desktop.
Save finestructure/8eeda2cb5539f89e268e895c91f99cf8 to your computer and use it in GitHub Desktop.
# Run with Rester: https://github.com/finestructure/Rester
variables:
BASE_URL: https://api.github.com/repos/brentsimmons/NetNewsWire
requests:
releases:
url: ${BASE_URL}/releases
headers:
# If you're getting rate limited by the Github API, run this
# restfile with a Github token.
# Uncomment the line starting with "Authorization:" below and
# - if you are running the binary set a GITHUB_TOKEN environment
# variable with your token
# - if running via docker, pass in the token as follows:
# `docker run -e GITHUB_TOKEN=<token> ...`
# Authorization: token ${GITHUB_TOKEN}
validation:
status: 200
json:
# validate the first id in the list (latest release)
# this also captures it as a variable
0:
id: .regex(\d+)
log:
# log the id to the console
- json[0].id
latest_release:
# use the release id to request release details
url: ${BASE_URL}/releases/${releases[0].id}
headers:
# If you're getting rate limited by the Github API, run this
# restfile with a Github token.
# Uncomment the line starting with "Authorization:" below and
# - if you are running the binary set a GITHUB_TOKEN environment
# variable with your token
# - if running via docker, pass in the token as follows:
# `docker run -e GITHUB_TOKEN=<token> ...`
# Authorization: token ${GITHUB_TOKEN}
validation:
status: 200
log:
# log the latest release tag to the console
- json.tag_name
downloads:
url: ${BASE_URL}/releases/${releases[0].id}
validation:
status: 200
log:
# log the id to the console
- json.assets[0].download_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment