Created
October 30, 2013 21:04
-
-
Save mgreensmith/7240245 to your computer and use it in GitHub Desktop.
Shows the timestamp of the HEAD commit of a remote branch in GitHub, without having to fetch it locally. Uses the octokit API client.
This file contains 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 ruby | |
require 'rubygems' | |
require 'octokit' | |
REPO = 'analog-analytics/merchant-portal' | |
BRANCH = 'master' | |
# get a token with: | |
# curl -u '<username>' -d '{"scopes":["repo"],"note":"for CLI use"}' https://api.github.com/authorizations | |
#token = File.read( File.expand_path("~/.chef/deployer/github.token")) | |
token = 'a1b23ch78edfhcHAHAHAHA_NOT_REALLY_MY_TOKEN' | |
github = Octokit::Client.new( :access_token => token ) | |
latest_commit_sha = github.ref(REPO,"heads/#{BRANCH}").object.sha | |
latest_commit = github.commit(REPO,latest_commit_sha) | |
puts latest_commit.commit.author.date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment