fix(plugin-workflow-loop): fix condition checking (#5634)

This commit is contained in:
Junyi 2024-11-12 12:25:51 +08:00 committed by GitHub
parent e42c480d85
commit 3f86115f84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,6 +111,8 @@ export default class extends Instruction {
job.set({ result: { looped: nextIndex } });
await processor.saveJob(job);
const length = getTargetLength(target);
if (nextIndex < length) {
if (loop.config.condition) {
const { calculation, expression, continueOnFalse } = loop.config.condition ?? {};
if (calculation || expression) {
@ -124,10 +126,6 @@ export default class extends Instruction {
}
}
}
const length = getTargetLength(target);
if (nextIndex < length) {
await processor.saveJob(job);
await processor.run(branch, job);
return processor.exit();
} else {