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
//thanks to https://gist.github.com/joshareed/5706061 | |
import groovy.json.JsonSlurper | |
def owner = "<owner>" | |
def project = "<project>" | |
// curl -k -u <user>:<token> -X GET https://api.github.com/repos/<owner>/<repo>/forks > forks.txt | |
def fetch(addr, params = [:]) { |
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
/** | |
* Simple Github API client that supports basic auth. | |
*/ | |
class GithubClient { | |
String username | |
String password | |
String owner | |
String repository | |
String fetchFileContents(String filePath) { |
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
//#!/usr/bin/env groovy | |
import groovy.json.JsonSlurper | |
import java.text.SimpleDateFormat | |
// fetches a Github API URL and parses the result as JSON | |
def fetch(addr, params = [:]) { | |
def auth = "<personal api token>" | |
def json = new JsonSlurper() | |
return json.parse(addr.toURL().newReader(requestProperties: ["Authorization": "token ${auth}".toString(), "Accept": "application/json"])) |
NewerOlder