Comments (6)
Created an issue in https://github.com/google/go-github
: google/go-github#2402
from multi-gitter.
The issue seems to come from a dependency, namely: github.com/google/go-github/v39
If we see the https://github.com/google/go-github/blob/master/github/pulls.go#L265 there they are expecting the value *PullRequest
to be returned, but in fact, we get returned a []PullRequest
. So I did the following change locally:
Original
// Create a new pull request on the specified repository.
//
// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request
func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
req, err := s.client.NewRequest("POST", u, pull)
if err != nil {
return nil, nil, err
}
p := new(PullRequest)
resp, err := s.client.Do(ctx, req, p)
if err != nil {
return nil, resp, err
}
return p, resp, nil
}
Change
// Create a new pull request on the specified repository.
//
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-pull-request
func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
req, err := s.client.NewRequest("POST", u, pull)
if err != nil {
return nil, nil, err
}
p := &[]PullRequest{}
resp, err := s.client.Do(ctx, req, p)
if err != nil {
return nil, resp, err
}
return &(*p)[0], resp, nil
}
I actually the PR created as expected and see no error output. Not sure if there is anything to do here in multi-gitter about this though? ๐ค
from multi-gitter.
Hi and thanks for the detailed report.
As you alluded to, I think this is a change that needs to be made in the go-github package. Please create a issue there, Iรคm happy to be a part of that discussion.
Do you know when this change happened, and if it is intended to come to none enterprise GitHub? The link in the updated code does 404 for me (https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-pull-request)
from multi-gitter.
I did some further investigation on this, and what happens is that when the PR is created, I get back a list of PRs (as if the endpoint GET /repos/{owner}/{repo}/pulls
was called). However, that list only includes another open PR, not the one I actually created via the script. This is super weird. So I am not sure if it is actually a problem with the github package itself or our Enterprise instance.
Ahh, sorry about that, I also tried to upgrade the github.com/google/go-github
package to see if that was the issue, so the change code is actually using version v45.2.0
. However, from my use case above, there was no difference between the two versions.
from multi-gitter.
Any updates on this? Did you figure out why your instance returned an array?
from multi-gitter.
Sorry, I have been on vacation for 5 weeks, so I have not had time to look into this further. However, I believe we can safely say that the issue I am having is not due to this service, so I can close this issue ๐
from multi-gitter.
Related Issues (20)
- Use repository metadata search as input for target repository list HOT 1
- Use code search as input for target repository list HOT 1
- Dependency Dashboard
- Use GraphQL to efficiently request details of multiple repositories (enhancement) HOT 1
- Use a file as repository input HOT 2
- Feature request: Add skip-group argument
- Using code search together with fork mode does not seem to work HOT 5
- Include pattern in .gitignore is not respected HOT 2
- Feature request: fork only when necessary HOT 1
- Feature request: option to pipe script output to PR-body
- Feature request: Add --comment to multi-gitter close HOT 2
- Feature request: Add --output-format option to multi-gitter run
- Assets are mising in v0.49.1 release HOT 1
- Strange behaviour? (sorry don't know how else to explain this)
- GITHUB_TOKEN is not being used by `multi-gitter` HOT 4
- Feature request: Add a flag to allow only pushing the Feature Branch without creating a PR, or pushing directly to an existing branch HOT 5
- Feature request: Draft PR -> Ready For Review HOT 4
- I would like to contribute this feature if it's a suitable addition to multi-gitter
- Feature request: Add flag to link created pull request with a GitHub project HOT 1
- `--team-reviewers` flag doesn't work on its own HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multi-gitter.