Commit 058f5a16 by Torkel Ödegaard Committed by GitHub

Release: Improved cherry pick task (#17087)

* Release: Improved cherry pick task

* Minor tweak to formatting
parent 0e210dc2
...@@ -16,22 +16,32 @@ const cherryPickRunner: TaskRunner<CherryPickOptions> = async () => { ...@@ -16,22 +16,32 @@ const cherryPickRunner: TaskRunner<CherryPickOptions> = async () => {
}, },
}); });
// sort by closed date // sort by closed date ASC
res.data.sort(function(a, b) { res.data.sort(function(a, b) {
return new Date(b.closed_at).getTime() - new Date(a.closed_at).getTime(); return new Date(a.closed_at).getTime() - new Date(b.closed_at).getTime();
}); });
let commands = '';
console.log('--------------------------------------------------------------------');
console.log('Printing PRs with cherry-pick-needed, in ASC merge date order');
console.log('--------------------------------------------------------------------');
for (const item of res.data) { for (const item of res.data) {
if (!item.milestone) { if (!item.milestone) {
console.log(item.number + ' missing milestone!'); console.log(item.number + ' missing milestone!');
continue; continue;
} }
console.log(`${item.title} (${item.number}) closed_at ${item.closed_at}`);
console.log(`\tURL: ${item.closed_at} ${item.html_url}`);
const issueDetails = await client.get(item.pull_request.url); const issueDetails = await client.get(item.pull_request.url);
console.log(`\tMerge sha: ${issueDetails.data.merge_commit_sha}`); console.log(`* ${item.title}, (#${item.number}), merge-sha: ${issueDetails.data.merge_commit_sha}`);
commands += `git cherry-pick -x ${issueDetails.data.merge_commit_sha}\n`;
} }
console.log('--------------------------------------------------------------------');
console.log('Commands (in order of how they should be executed)');
console.log('--------------------------------------------------------------------');
console.log(commands);
}; };
export const cherryPickTask = new Task<CherryPickOptions>(); export const cherryPickTask = new Task<CherryPickOptions>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment