mirror of
https://github.com/grafana/grafana.git
synced 2025-09-20 00:40:18 +08:00
Docs: Updated changelog for 6.1 release (#16224)
* Docs: Updated changelog for 6.1 release Also Updates the changelog cli task to group issues into bug fixes and not bug fixes. * Minor changelog fixes
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import _ from 'lodash';
|
||||
import { Task, TaskRunner } from './task';
|
||||
import axios from 'axios';
|
||||
|
||||
@ -20,30 +21,58 @@ const changelogTaskRunner: TaskRunner<ChangelogOptions> = async ({ milestone })
|
||||
},
|
||||
});
|
||||
|
||||
let markdown = '';
|
||||
|
||||
for (const item of res.data) {
|
||||
const issues = res.data.filter(item => {
|
||||
if (!item.milestone) {
|
||||
console.log('Item missing milestone', item.number);
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
return item.milestone.title === milestone;
|
||||
});
|
||||
|
||||
// For some reason I could not get the github api to filter on milestone and label
|
||||
// So doing this filter here
|
||||
if (item.milestone.title !== milestone) {
|
||||
continue;
|
||||
}
|
||||
const bugs = _.sortBy(
|
||||
issues.filter(item => {
|
||||
if (item.title.match(/fix|fixes/i)) {
|
||||
return true;
|
||||
}
|
||||
if (item.labels.find(label => label.name === 'type/bug')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}),
|
||||
'title'
|
||||
);
|
||||
|
||||
markdown += '* ' + item.title + '.';
|
||||
markdown += ` [#${item.number}](${githubGrafanaUrl}/pull/${item.number})`;
|
||||
markdown += `, [@${item.user.login}](${item.user.html_url})`;
|
||||
const notBugs = _.sortBy(res.data.filter(item => !bugs.find(bug => bug === item)), 'title');
|
||||
|
||||
markdown += '\n';
|
||||
let markdown = '### Features / Enhancements\n';
|
||||
|
||||
for (const item of notBugs) {
|
||||
markdown += getMarkdownLineForIssue(item);
|
||||
}
|
||||
|
||||
markdown += '\n### Bug Fixes\n';
|
||||
for (const item of bugs) {
|
||||
markdown += getMarkdownLineForIssue(item);
|
||||
}
|
||||
|
||||
console.log(markdown);
|
||||
};
|
||||
|
||||
function getMarkdownLineForIssue(item: any) {
|
||||
let markdown = '';
|
||||
let title = item.title.replace(/^([^:]*)/, (match, g1) => {
|
||||
return `**${g1}**`;
|
||||
});
|
||||
|
||||
markdown += '* ' + title + '.';
|
||||
markdown += ` [#${item.number}](${githubGrafanaUrl}/pull/${item.number})`;
|
||||
markdown += `, [@${item.user.login}](${item.user.html_url})`;
|
||||
|
||||
markdown += '\n';
|
||||
|
||||
return markdown;
|
||||
}
|
||||
|
||||
export const changelogTask = new Task<ChangelogOptions>();
|
||||
changelogTask.setName('Changelog generator task');
|
||||
changelogTask.setRunner(changelogTaskRunner);
|
||||
|
Reference in New Issue
Block a user