Skip to content

Instantly share code, notes, and snippets.

@juno
Created March 3, 2015 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juno/a100761e5d14d3c7ea5d to your computer and use it in GitHub Desktop.
Save juno/a100761e5d14d3c7ea5d to your computer and use it in GitHub Desktop.
Fetch pull request id by branch name using github api v3
require 'octokit'
owner = 'juno'
repo = 'foo'
branch_name = 'fix-issue-1'
Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN'])
pull_id = client.pulls("#{owner}/#{repo}", head: "#{owner}:#{branch_name}").first.number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment