Skip to content

Instantly share code, notes, and snippets.

@eddiewebb
Created June 28, 2018 13:29
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 eddiewebb/de8b147e3fe8473349d32abedf909103 to your computer and use it in GitHub Desktop.
Save eddiewebb/de8b147e3fe8473349d32abedf909103 to your computer and use it in GitHub Desktop.
Filter CIrcleCI build history by SSH rebuilds
#! /bin/bash
#
# This script pulls recent circleci build history, using jq to filter by ssh rebuilds, and printing the summary
# Requires `jq` and a CIRCLE_TOKEN
#
CCI_PROJECT="orgname/projectname"
curl -sSL -u ${CIRCLE_TOKEN}: 'https://circleci.com/api/v1.1/project/github/${CCI_PROJECT}?offset=0&limit=100' | jq -r '.[] | select(.ssh_users != []) | [.build_url, .ssh_users[0].login] | @csv'
# alternately use https://circleci.com/api/v1.1/recent-builds?offset=0&limit=100 for last N builds in all visible orgs based on users API token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment