سؤال

The documentation here:

http://developer.github.com/v3/repos/merging/

says you can include in your body head a commit SHA1 but i cannot seem to get this to work.

Here is what i have tried sending

 HTTParty.post('http://github.com/api/v3/repos/sclayton/puppet-modules/merges', :basic_auth => auth, :headers=>{'Content-Type' => "application/json"},
:body => {
"base" => "stage",
'head'=>"sha: a593765fc0861e99b4c9538e75676c55be264f01"}.to_json)

and

'head'=>"a593765fc0861e99b4c9538e75676c55be264f01"}.to_json

and

'head'=>{"sha" =>"a593765fc0861e99b4c9538e75676c55be264f01"}}.to_json)

I was wondering if anyone had accomplished merging a single commit through the Github API?

هل كانت مفيدة؟

المحلول

You need to use the real GitHub API:

HTTParty.post(
  'https://api.github.com/repos/sclayton/puppet-modules/merges',
  :basic_auth => auth,
  :headers=>{'Content-Type' => "application/json"},
  :body => {
    "base" => "stage",
    'head'=> "a593765fc0861e99b4c9538e75676c55be264f01"
  }.to_json)

Note the significant difference in URLs. Unless you're using a GitHub Enterprise instance, your URL should always start with https://api.github.com/. Of course this is only a guess because you didn't provide the response you were getting from GitHub.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top