mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Fix rebase-pr.js
This commit is contained in:
parent
34b9fe2ffe
commit
8c24b02fce
1 changed files with 9 additions and 3 deletions
|
@ -12,11 +12,17 @@ async function main() {
|
||||||
console.log("Pr ID: ", currentBranchPRID);
|
console.log("Pr ID: ", currentBranchPRID);
|
||||||
|
|
||||||
// Use gh commend to get pr commits
|
// Use gh commend to get pr commits
|
||||||
const prCommits = JSON.parse(execSync(`gh pr view ${currentBranchPRID} --json commits`).toString().trim());
|
const prCommits = JSON.parse(execSync(`gh pr view ${currentBranchPRID} --json commits`).toString().trim()).commits;
|
||||||
console.log("Found commits: ", prCommits.commits.length);
|
|
||||||
|
console.log("Found commits: ", prCommits.length);
|
||||||
|
|
||||||
|
// Sort the commits by authoredDate
|
||||||
|
prCommits.sort((a, b) => {
|
||||||
|
return new Date(a.authoredDate) - new Date(b.authoredDate);
|
||||||
|
});
|
||||||
|
|
||||||
// Get the oldest commit id
|
// Get the oldest commit id
|
||||||
const oldestCommitID = prCommits.commits[prCommits.commits.length - 1].oid;
|
const oldestCommitID = prCommits[0].oid;
|
||||||
console.log("Oldest commit id of this pr:", oldestCommitID);
|
console.log("Oldest commit id of this pr:", oldestCommitID);
|
||||||
|
|
||||||
// Get the latest commit id of the target branch
|
// Get the latest commit id of the target branch
|
||||||
|
|
Loading…
Reference in a new issue