Skip to content

Commit

Permalink
Use boolean and if-else chain for digest update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoesters committed Aug 27, 2024
1 parent dff209b commit 87ba1b3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/workers/repository/process/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,15 @@ export async function lookupUpdates(
// Add digests if necessary
if (supportsDigests(config.datasource)) {
if (config.currentDigest) {
// Custom datasources should not run a digest update
// on the current version if it already runs a version update.
if (
!(
config.digestOneAndOnly ?? config.datasource.startsWith('custom.')
) ||
!res.updates.length
) {
let alwaysUpdateDigest = true;
if (config.digestOneAndOnly === true) {
alwaysUpdateDigest = false;
} else if (config.datasource.startsWith('custom.')) {
// Custom datasources should not run a digest update
// on the current version if it already runs a version update.
alwaysUpdateDigest = false;
}
if (alwaysUpdateDigest || !res.updates.length) {
// digest update
res.updates.push({
updateType: 'digest',
Expand Down

0 comments on commit 87ba1b3

Please sign in to comment.