Skip to content

Instantly share code, notes, and snippets.

@igorwwwwwwwwwwwwwwwwwwww
Created April 28, 2016 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save igorwwwwwwwwwwwwwwwwwwww/ee96b87de09c0a9fb13b30ee7f24c91d to your computer and use it in GitHub Desktop.
Save igorwwwwwwwwwwwwwwwwwwww/ee96b87de09c0a9fb13b30ee7f24c91d to your computer and use it in GitHub Desktop.
source "https://rubygems.org"
gem "octokit", "~> 4.0"
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