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

fix(gitlab): fetch all open issues #6597

Merged
merged 2 commits into from Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/platform/gitlab/__snapshots__/index.spec.ts.snap
Expand Up @@ -714,7 +714,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?state=opened",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened",
},
Object {
"body": "{\\"title\\":\\"new-title\\",\\"description\\":\\"new-content\\"}",
Expand Down Expand Up @@ -744,7 +744,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?state=opened",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened",
},
Object {
"headers": Object {
Expand All @@ -771,7 +771,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?state=opened",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened",
},
Object {
"headers": Object {
Expand Down Expand Up @@ -812,7 +812,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?state=opened",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened",
},
Object {
"body": "{\\"state_event\\":\\"close\\"}",
Expand Down Expand Up @@ -842,7 +842,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?state=opened",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened",
},
Object {
"headers": Object {
Expand All @@ -869,7 +869,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?state=opened",
"url": "https://gitlab.com/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened",
},
]
`;
Expand Down
24 changes: 18 additions & 6 deletions lib/platform/gitlab/index.spec.ts
Expand Up @@ -712,7 +712,9 @@ describe('platform/gitlab', () => {
it('returns null if no issue', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/undefined/issues?state=opened')
.get(
'/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened'
)
.reply(200, [
{
iid: 1,
Expand All @@ -730,7 +732,9 @@ describe('platform/gitlab', () => {
it('finds issue', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/undefined/issues?state=opened')
.get(
'/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened'
)
.reply(200, [
{
iid: 1,
Expand All @@ -752,7 +756,9 @@ describe('platform/gitlab', () => {
it('creates issue', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/undefined/issues?state=opened')
.get(
'/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened'
)
.reply(200, [
{
iid: 1,
Expand All @@ -775,7 +781,9 @@ describe('platform/gitlab', () => {
it('updates issue', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/undefined/issues?state=opened')
.get(
'/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened'
)
.reply(200, [
{
iid: 1,
Expand All @@ -800,7 +808,9 @@ describe('platform/gitlab', () => {
it('skips update if unchanged', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/undefined/issues?state=opened')
.get(
'/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened'
)
.reply(200, [
{
iid: 1,
Expand All @@ -825,7 +835,9 @@ describe('platform/gitlab', () => {
it('closes issue', async () => {
httpMock
.scope(gitlabApiHost)
.get('/api/v4/projects/undefined/issues?state=opened')
.get(
'/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened'
)
.reply(200, [
{
iid: 1,
Expand Down
8 changes: 7 additions & 1 deletion lib/platform/gitlab/index.ts
Expand Up @@ -742,10 +742,16 @@ export async function setBranchStatus({

export async function getIssueList(): Promise<any[]> {
if (!config.issueList) {
const query = new URLSearchParams({
per_page: '100',
author_id: `${authorId}`,
state: 'opened',
}).toString();
const res = await gitlabApi.getJson<{ iid: number; title: string }[]>(
`projects/${config.repository}/issues?state=opened`,
`projects/${config.repository}/issues?${query}`,
{
useCache: false,
paginate: true,
}
);
// istanbul ignore if
Expand Down