Created
April 28, 2016 14:27
-
-
Save igorwwwwwwwwwwwwwwwwwwww/ee96b87de09c0a9fb13b30ee7f24c91d to your computer and use it in GitHub Desktop.
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
source "https://rubygems.org" | |
gem "octokit", "~> 4.0" |
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
require 'octokit' | |
Octokit.configure do |c| | |
# create a token here https://github.com/settings/tokens/new | |
c.access_token = '...' | |
end | |
# replace this with your repo and .travis.yml sha | |
repo = 'igorwwwwwwwwwwwwwwwwwwww/hello-world' | |
travis_yml_sha = '3063d5f6554f4d3470a62249e69788fc1e289c69' | |
prs = Octokit.pull_requests(repo, state: 'open') | |
prs.each do |pr| | |
tree = Octokit.tree(repo, pr.head.sha) | |
blob = tree.tree.find do |f| f.type == 'blob' && f.path == '.travis.yml' end | |
if blob.sha == travis_yml_sha | |
Octokit.create_status(repo, pr.head.sha, 'success', { | |
context: 'travis-yml-modified', | |
description: '.travis.yml is intact' | |
}) | |
else | |
Octokit.create_status(repo, pr.head.sha, 'failure', { | |
context: 'travis-yml-modified', | |
description: '.travis.yml was modified!' | |
}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment