@tama-create/sf-tools 1.4.0-dev.1 → 1.4.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/promote-check.js +17 -5
- package/package.json +1 -1
|
@@ -199,15 +199,22 @@ export async function runPromoteCheck(args, box, deps) {
|
|
|
199
199
|
throw new CannotJudge(`${sha.slice(0, 7)} の ${tier} の印を確かめられません。`);
|
|
200
200
|
return m === 0;
|
|
201
201
|
};
|
|
202
|
-
|
|
202
|
+
// 対象のファイルが両方とも「実質的な行なし」なら true。ファイルがないときは null(check-branch は、ないものを「対象なし」として通すため、
|
|
203
|
+
// 版・ワークフローだけを変える PR は、ないままマージされる。呼ぶ側が、その場合だけ「空」として扱う)
|
|
204
|
+
const targetsState = (branch) => {
|
|
203
205
|
const dir = `sf-tools/release/${branch}`;
|
|
204
206
|
const a = countTargets(box, `${dir}/deploy-target.txt`);
|
|
205
207
|
const b = a === null ? null : countTargets(box, `${dir}/remove-target.txt`);
|
|
206
|
-
if (a === null || b === null)
|
|
207
|
-
|
|
208
|
-
}
|
|
208
|
+
if (a === null || b === null)
|
|
209
|
+
return null;
|
|
209
210
|
return a + b === 0;
|
|
210
211
|
};
|
|
212
|
+
const targetsEmpty = (branch) => {
|
|
213
|
+
const st = targetsState(branch);
|
|
214
|
+
if (st === null)
|
|
215
|
+
throw new CannotJudge(`sf-tools/release/${branch}/ の deploy-target.txt・remove-target.txt がありません。`);
|
|
216
|
+
return st;
|
|
217
|
+
};
|
|
211
218
|
// --- R2: 積み重ね ---
|
|
212
219
|
const checkR2Rule = async (branch, head, tier) => {
|
|
213
220
|
log("INFO", `R2(積み重ね): ${branch} から ${tier} へ前に出したリリースの部品が、今回に含まれるかを確かめます...`);
|
|
@@ -284,12 +291,17 @@ export async function runPromoteCheck(args, box, deps) {
|
|
|
284
291
|
}
|
|
285
292
|
if (!isEnvBranch(pr.branch)) {
|
|
286
293
|
// 対象が空でも、sf-tools の版・ワークフローを変える PR は、前の段階の印を求める(R1 だけ。部品がないため R2 は要らない)
|
|
287
|
-
|
|
294
|
+
// ファイルがないときは、版・ワークフローを変える PR(--tooling か、差分に含まれる)に限り、「空」として扱う。ほかは、判断できない(2)
|
|
295
|
+
const state = targetsState(pr.branch);
|
|
296
|
+
const empty = state ?? true;
|
|
288
297
|
// 移動(rename)は、削除と追加の 2 行にして、移動前のパスも見る(ci-check-branch の API の判定と同じ)
|
|
289
298
|
if (empty && !tooling) {
|
|
290
299
|
await must(git("fetch", "--quiet", "origin", pr.target), `origin の ${pr.target} を取得できません。`);
|
|
291
300
|
const changed = await must(git("diff", "--name-only", "--no-renames", `origin/${pr.target}...HEAD`), `${pr.target} との差分の一覧を取得できません。`);
|
|
292
301
|
const toolingFiles = changed.split("\n").filter((f) => isToolingPath(f.trim()));
|
|
302
|
+
if (toolingFiles.length === 0 && state === null) {
|
|
303
|
+
throw new CannotJudge(`sf-tools/release/${pr.branch}/ の deploy-target.txt・remove-target.txt がありません。`);
|
|
304
|
+
}
|
|
293
305
|
if (toolingFiles.length === 0) {
|
|
294
306
|
log("INFO", "対象が空です(deploy-target.txt・remove-target.txt)。リリースしないため、確かめません。");
|
|
295
307
|
result.skipped = true;
|