From 3146500de5c0d69b32ec95fd0a654cefafb0c66e Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Wed, 27 Mar 2019 09:37:21 +0100 Subject: [PATCH] Fix: scripts changelog cli per page set to 100 GitHub pagination was limiting the result to 30 issues. This fix makes the changelog script return up to 100 issues. Will have to add a loop to fetch more once we merge more than 100 PR's that should be added to the changelog. Also, fixes a bug where issues that were not included in the milestone were being returned. --- scripts/cli/tasks/changelog.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/cli/tasks/changelog.ts b/scripts/cli/tasks/changelog.ts index b6d10cac481..6ecbad4ab83 100644 --- a/scripts/cli/tasks/changelog.ts +++ b/scripts/cli/tasks/changelog.ts @@ -1,6 +1,6 @@ +import axios from 'axios'; import _ from 'lodash'; import { Task, TaskRunner } from './task'; -import axios from 'axios'; const githubGrafanaUrl = 'https://github.com/grafana/grafana'; @@ -9,7 +9,7 @@ interface ChangelogOptions { } const changelogTaskRunner: TaskRunner = async ({ milestone }) => { - let client = axios.create({ + const client = axios.create({ baseURL: 'https://api.github.com/repos/grafana/grafana', timeout: 10000, }); @@ -17,6 +17,7 @@ const changelogTaskRunner: TaskRunner = async ({ milestone }) const res = await client.get('/issues', { params: { state: 'closed', + per_page: 100, labels: 'add to changelog', }, }); @@ -42,7 +43,7 @@ const changelogTaskRunner: TaskRunner = async ({ milestone }) 'title' ); - const notBugs = _.sortBy(res.data.filter(item => !bugs.find(bug => bug === item)), 'title'); + const notBugs = _.sortBy(issues.filter(item => !bugs.find(bug => bug === item)), 'title'); let markdown = '### Features / Enhancements\n'; @@ -60,7 +61,7 @@ const changelogTaskRunner: TaskRunner = async ({ milestone }) function getMarkdownLineForIssue(item: any) { let markdown = ''; - let title = item.title.replace(/^([^:]*)/, (match, g1) => { + const title = item.title.replace(/^([^:]*)/, (match, g1) => { return `**${g1}**`; });