Skip to content

Commit

Permalink
最新ビルドのコミットID取得で、ビルドでないコミットを除外する
Browse files Browse the repository at this point in the history
  • Loading branch information
elleonard committed Feb 28, 2024
1 parent ff85214 commit 940b1d2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/buildDispatcher/buildIncremental.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ await $`git fetch origin release`;
/**
* releaseブランチの最新コミットのコメントから、最後にビルドされたmasterのコミットIDを取得する
*/
const lastBuildCommit = await $`git log --first-parent origin/release --pretty=oneline -n 1`;
const commitId = await (async () => {
let result = '';
let head = 'origin/release';
while(!/[0-9a-z]+/.test(result)) {
const commit = await $`git log --first-parent ${head} --pretty=oneline -n 1`;
result = commit.stdout.trim().split(" ")[1];
head+='~';
}
})();

/**
* 差分検出
* @type string[]
*/
const diffFiles = await $`git --no-pager diff ${lastBuildCommit.stdout.trim().split(" ")[1]} HEAD --name-only`;
const diffFiles = await $`git --no-pager diff ${commitId} HEAD --name-only`;

/**
* ひとまず、インクリメンタルビルドはcodesのみ対象とする
Expand Down

0 comments on commit 940b1d2

Please sign in to comment.