Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_pull_request gets 404 #75

Closed
stuartf opened this issue Mar 28, 2012 · 2 comments
Closed

create_pull_request gets 404 #75

stuartf opened this issue Mar 28, 2012 · 2 comments

Comments

@stuartf
Copy link

stuartf commented Mar 28, 2012

I have a script like:

#!/usr/bin/env ruby

require "git"
require "octokit"

upstream = "sakaiproject"
client = Octokit::Client.new(:login => "stuartf", :password => "REDACTED")

base = "master"
git = Git.open(Dir.pwd)
ghuser = git.remote.url.slice(/:([^\/]*)/, 1)
head = "#{ghuser}:#{git.current_branch}"
title = git.current_branch
body = "https://jira.sakaiproject.org/browse/#{git.current_branch}"
project = git.remote(upstream).url.slice(/\/([^\/]*)\.git$/, 1)

client.create_pull_request("#{upstream}/#{project}", base, head, title, body)

The idea is you run git pr and it makes a pull request in upstream for the current branch with a title that is the current branch name. But when I run it I get:

/home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/octokit-1.0.0/lib/faraday/response/raise_octokit_error.rb:16:in `on_complete': POST https://api.github.com/repos/sakaiproject/nakamura/pulls: 404: Not Found (Octokit::NotFound)
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.7.6/lib/faraday/response.rb:9:in `block in call'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.7.6/lib/faraday/response.rb:62:in `on_complete'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.7.6/lib/faraday/response.rb:8:in `call'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.7.6/lib/faraday/request/json.rb:32:in `call'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.7.6/lib/faraday/connection.rb:210:in `run_request'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.7.6/lib/faraday/connection.rb:98:in `post'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/octokit-1.0.0/lib/octokit/request.rb:28:in `request'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/octokit-1.0.0/lib/octokit/request.rb:18:in `post'
    from /home/stuart/.rvm/gems/ruby-1.9.3-p125/gems/octokit-1.0.0/lib/octokit/client/pulls.rb:11:in `create_pull_request'
    from /home/stuart/bin/git-pr:17:in `<main>'

Which doesn't make sense to me because a GET to https://api.github.com/repos/sakaiproject/nakamura/pulls works fine. Am I doing something wrong or is this a bug in octokit or the github api?

@pengwynn
Copy link
Collaborator

Sorry about that. Can you test against master?

@stuartf
Copy link
Author

stuartf commented Mar 28, 2012

Thanks, master is working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants