From eadc4b6df1dcba4c7b73de54ce70de1d5794b92a Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Fri, 28 Nov 2025 18:15:10 +0100 Subject: [PATCH 1/2] feat(trigger): allow for digest-only trigger threshold --- app/triggers/providers/Trigger.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/triggers/providers/Trigger.js b/app/triggers/providers/Trigger.js index 315b9d5f..6096d0d3 100644 --- a/app/triggers/providers/Trigger.js +++ b/app/triggers/providers/Trigger.js @@ -54,6 +54,13 @@ class Trigger extends Component { static isThresholdReached(containerResult, threshold) { let thresholdPassing = true; if ( + threshold.toLowerCase() == 'digest' && + containerResult.updateKind && + containerResult.updateKind.kind === 'digest' + ) { + thresholdPassing = true; + } + else if ( threshold.toLowerCase() !== 'all' && containerResult.updateKind && containerResult.updateKind.kind === 'tag' && @@ -78,6 +85,7 @@ class Trigger extends Component { containerResult.updateKind.semverDiff !== 'major' && containerResult.updateKind.semverDiff !== 'minor'; break; + break; default: thresholdPassing = true; } From e95ad687bb826960bc0ba02ca8bb6b754c8026cf Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Fri, 28 Nov 2025 18:28:14 +0100 Subject: [PATCH 2/2] Adapt for #756 --- app/triggers/providers/Trigger.js | 55 ++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/app/triggers/providers/Trigger.js b/app/triggers/providers/Trigger.js index 6096d0d3..f5731621 100644 --- a/app/triggers/providers/Trigger.js +++ b/app/triggers/providers/Trigger.js @@ -49,49 +49,64 @@ class Trigger extends Component { * Return true if update reaches trigger threshold. * @param containerResult * @param threshold + * @param nonDigestOnly - If true, digest updates are never allowed; only semver changes count. * @returns {boolean} */ - static isThresholdReached(containerResult, threshold) { + static isThresholdReached(containerResult, threshold, nonDigestOnly = false) { let thresholdPassing = true; + + const updateKind = containerResult.updateKind?.kind; + const semverDiff = containerResult.updateKind?.semverDiff; + + // If non-digest-only is enabled, then digest updates must NEVER count + if (nonDigestOnly && updateKind === 'digest') { + return false; + } + + // --- Handle DIGEST threshold --- if ( - threshold.toLowerCase() == 'digest' && - containerResult.updateKind && - containerResult.updateKind.kind === 'digest' + threshold.toLowerCase() === 'digest' && + updateKind === 'digest' ) { - thresholdPassing = true; + return true; } - else if ( + + // --- Handle SEMVER TAG threshold paths --- + if ( threshold.toLowerCase() !== 'all' && - containerResult.updateKind && - containerResult.updateKind.kind === 'tag' && - containerResult.updateKind.semverDiff && - containerResult.updateKind.semverDiff !== 'unknown' + updateKind === 'tag' && + semverDiff && + semverDiff !== 'unknown' ) { - switch (threshold) { + switch (threshold.toLowerCase()) { case 'major-only': - thresholdPassing = - containerResult.updateKind.semverDiff == 'major'; + thresholdPassing = semverDiff === 'major'; break; + case 'minor-only': - thresholdPassing = - containerResult.updateKind.semverDiff == 'minor'; + thresholdPassing = semverDiff === 'minor'; break; + case 'minor': - thresholdPassing = - containerResult.updateKind.semverDiff !== 'major'; + // minor or patch + thresholdPassing = semverDiff !== 'major'; break; + case 'patch': + // only patch thresholdPassing = - containerResult.updateKind.semverDiff !== 'major' && - containerResult.updateKind.semverDiff !== 'minor'; - break; + semverDiff !== 'major' && semverDiff !== 'minor'; break; + default: thresholdPassing = true; } } + return thresholdPassing; } +} + /** * Parse $name:$threshold string.