|
@@ -1,18 +1,14 @@
|
|
|
-import axios from 'axios';
|
|
|
|
|
import _ from 'lodash';
|
|
import _ from 'lodash';
|
|
|
import { Task, TaskRunner } from './task';
|
|
import { Task, TaskRunner } from './task';
|
|
|
-
|
|
|
|
|
-const githubGrafanaUrl = 'https://github.com/grafana/grafana';
|
|
|
|
|
|
|
+import GithubClient from '../utils/githubClient';
|
|
|
|
|
|
|
|
interface ChangelogOptions {
|
|
interface ChangelogOptions {
|
|
|
milestone: string;
|
|
milestone: string;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const changelogTaskRunner: TaskRunner<ChangelogOptions> = async ({ milestone }) => {
|
|
const changelogTaskRunner: TaskRunner<ChangelogOptions> = async ({ milestone }) => {
|
|
|
- const client = axios.create({
|
|
|
|
|
- baseURL: 'https://api.github.com/repos/grafana/grafana',
|
|
|
|
|
- timeout: 10000,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const githubClient = new GithubClient();
|
|
|
|
|
+ const client = githubClient.client;
|
|
|
|
|
|
|
|
if (!/^\d+$/.test(milestone)) {
|
|
if (!/^\d+$/.test(milestone)) {
|
|
|
console.log('Use milestone number not title, find number in milestone url');
|
|
console.log('Use milestone number not title, find number in milestone url');
|
|
@@ -45,13 +41,20 @@ const changelogTaskRunner: TaskRunner<ChangelogOptions> = async ({ milestone })
|
|
|
|
|
|
|
|
const notBugs = _.sortBy(issues.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';
|
|
|
|
|
|
|
+ let markdown = '';
|
|
|
|
|
+
|
|
|
|
|
+ if (notBugs.length > 0) {
|
|
|
|
|
+ markdown = '### Features / Enhancements\n';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
for (const item of notBugs) {
|
|
for (const item of notBugs) {
|
|
|
markdown += getMarkdownLineForIssue(item);
|
|
markdown += getMarkdownLineForIssue(item);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- markdown += '\n### Bug Fixes\n';
|
|
|
|
|
|
|
+ if (bugs.length > 0) {
|
|
|
|
|
+ markdown += '\n### Bug Fixes\n';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
for (const item of bugs) {
|
|
for (const item of bugs) {
|
|
|
markdown += getMarkdownLineForIssue(item);
|
|
markdown += getMarkdownLineForIssue(item);
|
|
|
}
|
|
}
|
|
@@ -60,6 +63,7 @@ const changelogTaskRunner: TaskRunner<ChangelogOptions> = async ({ milestone })
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
function getMarkdownLineForIssue(item: any) {
|
|
function getMarkdownLineForIssue(item: any) {
|
|
|
|
|
+ const githubGrafanaUrl = 'https://github.com/grafana/grafana';
|
|
|
let markdown = '';
|
|
let markdown = '';
|
|
|
const title = item.title.replace(/^([^:]*)/, (match, g1) => {
|
|
const title = item.title.replace(/^([^:]*)/, (match, g1) => {
|
|
|
return `**${g1}**`;
|
|
return `**${g1}**`;
|