mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
Added basic cherry pick helping task
This commit is contained in:
parent
153b3e5cf5
commit
7b67dcfbb8
@ -140,8 +140,7 @@
|
||||
"gui:releasePrepare": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts gui:release",
|
||||
"gui:publish": "cd packages/grafana-ui/dist && npm publish --access public",
|
||||
"gui:release": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts gui:release -p",
|
||||
"cli:help": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts --help",
|
||||
"cli:changelog": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts core:changelog"
|
||||
"cli": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -5,6 +5,7 @@ import { startTask } from './tasks/core.start';
|
||||
import { buildTask } from './tasks/grafanaui.build';
|
||||
import { releaseTask } from './tasks/grafanaui.release';
|
||||
import { changelogTask } from './tasks/changelog';
|
||||
import { cherryPickTask } from './tasks/cherrypick';
|
||||
|
||||
program.option('-d, --depreciate <scripts>', 'Inform about npm script deprecation', v => v.split(','));
|
||||
|
||||
@ -40,7 +41,7 @@ program
|
||||
});
|
||||
|
||||
program
|
||||
.command('core:changelog')
|
||||
.command('changelog')
|
||||
.option('-m, --milestone <milestone>', 'Specify milestone')
|
||||
.description('Builds changelog markdown')
|
||||
.action(async cmd => {
|
||||
@ -54,6 +55,13 @@ program
|
||||
});
|
||||
});
|
||||
|
||||
program
|
||||
.command('cherrypick')
|
||||
.description('Helps find commits to cherry pick')
|
||||
.action(async cmd => {
|
||||
await execTask(cherryPickTask)({});
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (program.depreciate && program.depreciate.length === 2) {
|
||||
|
42
scripts/cli/tasks/cherrypick.ts
Normal file
42
scripts/cli/tasks/cherrypick.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import { Task, TaskRunner } from './task';
|
||||
import axios from 'axios';
|
||||
|
||||
interface CherryPickOptions {}
|
||||
|
||||
const cherryPickRunner: TaskRunner<CherryPickOptions> = async () => {
|
||||
let client = axios.create({
|
||||
baseURL: 'https://api.github.com/repos/grafana/grafana',
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
const res = await client.get('/issues', {
|
||||
params: {
|
||||
state: 'closed',
|
||||
labels: 'cherry-pick needed',
|
||||
},
|
||||
});
|
||||
|
||||
// sort by closed date
|
||||
res.data.sort(function(a, b) {
|
||||
return new Date(b.closed_at).getTime() - new Date(a.closed_at).getTime();
|
||||
});
|
||||
|
||||
for (const item of res.data) {
|
||||
if (!item.milestone) {
|
||||
console.log(item.number + ' missing milestone!');
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(item.number + ' closed_at ' + item.closed_at + ' ' + item.html_url);
|
||||
const issueDetails = await client.get(item.pull_request.url);
|
||||
const commits = await client.get(issueDetails.data.commits_url);
|
||||
|
||||
for (const commit of commits.data) {
|
||||
console.log(commit.commit.message + ' sha: ' + commit.sha);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const cherryPickTask = new Task<CherryPickOptions>();
|
||||
cherryPickTask.setName('Cherry pick task');
|
||||
cherryPickTask.setRunner(cherryPickRunner);
|
Loading…
Reference in New Issue
Block a user