mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 08:02:18 +02: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
@ -4047,7 +4047,7 @@ const docTemplate = `{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"index": {
|
||||
"type": "integer"
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
@ -369,7 +370,7 @@ func (c *config) PullRequests(ctx context.Context, u *model.User, r *model.Repo,
|
||||
result := []*model.PullRequest{}
|
||||
for _, pullRequest := range pullRequests {
|
||||
result = append(result, &model.PullRequest{
|
||||
Index: int64(pullRequest.ID),
|
||||
Index: model.ForgeRemoteID(strconv.Itoa(int(pullRequest.ID))),
|
||||
Title: pullRequest.Title,
|
||||
})
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ func Test_bitbucket(t *testing.T) {
|
||||
repoPRs, err := c.PullRequests(ctx, fakeUser, fakeRepo, &listOpts)
|
||||
g.Assert(err).IsNil()
|
||||
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() {
|
||||
_, 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))
|
||||
for i := range pullRequests {
|
||||
result[i] = &model.PullRequest{
|
||||
Index: pullRequests[i].Index,
|
||||
Index: model.ForgeRemoteID(strconv.Itoa(int(pullRequests[i].Index))),
|
||||
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))
|
||||
for i := range pullRequests {
|
||||
result[i] = &model.PullRequest{
|
||||
Index: int64(pullRequests[i].GetNumber()),
|
||||
Index: model.ForgeRemoteID(strconv.Itoa(pullRequests[i].GetNumber())),
|
||||
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))
|
||||
for i := range pullRequests {
|
||||
result[i] = &model.PullRequest{
|
||||
Index: int64(pullRequests[i].ID),
|
||||
Index: model.ForgeRemoteID(strconv.Itoa(pullRequests[i].ID)),
|
||||
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
|
||||
|
||||
|
@ -15,6 +15,6 @@
|
||||
package model
|
||||
|
||||
type PullRequest struct {
|
||||
Index int64 `json:"index"`
|
||||
Title string `json:"title"`
|
||||
Index ForgeRemoteID `json:"index"`
|
||||
Title string `json:"title"`
|
||||
} // @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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// A version control pull request.
|
||||
export type PullRequest = {
|
||||
// The index of the pull request.
|
||||
index: number;
|
||||
index: string;
|
||||
// The title of the pull request.
|
||||
title: string;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user