mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-20 22:28:35 +00:00
Change PullRequest Index to ForgeRemoteID / string type (#2823)
Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com> Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com> Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
parent
418acc5c98
commit
981384b79a
10 changed files with 12 additions and 11 deletions
|
@ -4047,7 +4047,7 @@ const docTemplate = `{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"index": {
|
"index": {
|
||||||
"type": "integer"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
|
|
||||||
|
@ -369,7 +370,7 @@ func (c *config) PullRequests(ctx context.Context, u *model.User, r *model.Repo,
|
||||||
result := []*model.PullRequest{}
|
result := []*model.PullRequest{}
|
||||||
for _, pullRequest := range pullRequests {
|
for _, pullRequest := range pullRequests {
|
||||||
result = append(result, &model.PullRequest{
|
result = append(result, &model.PullRequest{
|
||||||
Index: int64(pullRequest.ID),
|
Index: model.ForgeRemoteID(strconv.Itoa(int(pullRequest.ID))),
|
||||||
Title: pullRequest.Title,
|
Title: pullRequest.Title,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ func Test_bitbucket(t *testing.T) {
|
||||||
repoPRs, err := c.PullRequests(ctx, fakeUser, fakeRepo, &listOpts)
|
repoPRs, err := c.PullRequests(ctx, fakeUser, fakeRepo, &listOpts)
|
||||||
g.Assert(err).IsNil()
|
g.Assert(err).IsNil()
|
||||||
g.Assert(repoPRs[0].Title).Equal("PRs title")
|
g.Assert(repoPRs[0].Title).Equal("PRs title")
|
||||||
g.Assert(repoPRs[0].Index).Equal(int64(123))
|
g.Assert(repoPRs[0].Index).Equal(model.ForgeRemoteID("123"))
|
||||||
})
|
})
|
||||||
g.It("Should handle not found errors", func() {
|
g.It("Should handle not found errors", func() {
|
||||||
_, err := c.PullRequests(ctx, fakeUser, fakeRepoNotFound, &listOpts)
|
_, err := c.PullRequests(ctx, fakeUser, fakeRepoNotFound, &listOpts)
|
||||||
|
|
|
@ -488,7 +488,7 @@ func (c *Gitea) PullRequests(ctx context.Context, u *model.User, r *model.Repo,
|
||||||
result := make([]*model.PullRequest, len(pullRequests))
|
result := make([]*model.PullRequest, len(pullRequests))
|
||||||
for i := range pullRequests {
|
for i := range pullRequests {
|
||||||
result[i] = &model.PullRequest{
|
result[i] = &model.PullRequest{
|
||||||
Index: pullRequests[i].Index,
|
Index: model.ForgeRemoteID(strconv.Itoa(int(pullRequests[i].Index))),
|
||||||
Title: pullRequests[i].Title,
|
Title: pullRequests[i].Title,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,7 +296,7 @@ func (c *client) PullRequests(ctx context.Context, u *model.User, r *model.Repo,
|
||||||
result := make([]*model.PullRequest, len(pullRequests))
|
result := make([]*model.PullRequest, len(pullRequests))
|
||||||
for i := range pullRequests {
|
for i := range pullRequests {
|
||||||
result[i] = &model.PullRequest{
|
result[i] = &model.PullRequest{
|
||||||
Index: int64(pullRequests[i].GetNumber()),
|
Index: model.ForgeRemoteID(strconv.Itoa(pullRequests[i].GetNumber())),
|
||||||
Title: pullRequests[i].GetTitle(),
|
Title: pullRequests[i].GetTitle(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,7 +326,7 @@ func (g *GitLab) PullRequests(ctx context.Context, u *model.User, r *model.Repo,
|
||||||
result := make([]*model.PullRequest, len(pullRequests))
|
result := make([]*model.PullRequest, len(pullRequests))
|
||||||
for i := range pullRequests {
|
for i := range pullRequests {
|
||||||
result[i] = &model.PullRequest{
|
result[i] = &model.PullRequest{
|
||||||
Index: int64(pullRequests[i].ID),
|
Index: model.ForgeRemoteID(strconv.Itoa(pullRequests[i].ID)),
|
||||||
Title: pullRequests[i].Title,
|
Title: pullRequests[i].Title,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.36.1. DO NOT EDIT.
|
// Code generated by mockery v2.37.1. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
type PullRequest struct {
|
type PullRequest struct {
|
||||||
Index int64 `json:"index"`
|
Index ForgeRemoteID `json:"index"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
} // @name PullRequest
|
} // @name PullRequest
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by mockery v2.36.1. DO NOT EDIT.
|
// Code generated by mockery v2.37.1. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// A version control pull request.
|
// A version control pull request.
|
||||||
export type PullRequest = {
|
export type PullRequest = {
|
||||||
// The index of the pull request.
|
// The index of the pull request.
|
||||||
index: number;
|
index: string;
|
||||||
// The title of the pull request.
|
// The title of the pull request.
|
||||||
title: string;
|
title: string;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue