Last active
August 29, 2015 14:27
-
-
Save fmasuhr/5789c787a8cc6b20ca85 to your computer and use it in GitHub Desktop.
Review Github pull requests assigned to authenticated user
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' | |
TITLE = 'example title' | |
LABEL = 'ready to merge' | |
COMMENT = '+B' | |
client = Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN']) | |
pulls = client.list_issues.select { |issue| | |
issue.pull_request && | |
issue.labels.select { |l| l.name == LABEL }.empty? && | |
issue.title == TITLE | |
} | |
pulls.each do |pull| | |
client.add_labels_to_an_issue(pull.repository.full_name, pull.number, [LABEL]) | |
client.add_comment(pull.repository.full_name, pull.number, COMMENT) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment