Skip to content

Commit

Permalink
feat: extend skipStage to extract, lookup (#33108)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins authored Dec 14, 2024
1 parent d898d7f commit 07c0058
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/modules/manager/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import type {
ValidationMessage,
} from '../../config/types';
import type { Category } from '../../constants';
import type { ModuleApi, RangeStrategy, SkipReason } from '../../types';
import type {
ModuleApi,
RangeStrategy,
SkipReason,
StageName,
} from '../../types';
import type { FileChange } from '../../util/git/types';
import type { MergeConfidence } from '../../util/merge-confidence/types';
import type { CustomExtractConfig } from './custom/types';
Expand Down Expand Up @@ -144,6 +149,7 @@ export interface PackageDependency<T = Record<string, any>>
registryUrls?: string[] | null;
rangeStrategy?: RangeStrategy;
skipReason?: SkipReason;
skipStage?: StageName;
sourceLine?: number;
newVersion?: string;
updates?: LookupUpdate[];
Expand Down
2 changes: 1 addition & 1 deletion lib/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type { CommitMessageJSON } from './commit-message-json';
export type { HostRule, CombinedHostRule } from './host-rules';
export type { SkipReason } from './skip-reason';
export type { SkipReason, StageName } from './skip-reason';
export type { RangeStrategy } from './versioning';
export type { BranchStatus } from './branch-status';
export type {
Expand Down
2 changes: 2 additions & 0 deletions lib/types/skip-reason.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ export type SkipReason =
export type StageName =
| 'current-timestamp'
| 'datasource-merge'
| 'extract'
| 'lock-file-maintenance-merge'
| 'lock-file-maintenance-merge-2'
| 'lookup'
| 'pre-lookup'
| 'source-url'
| 'update-type'
Expand Down
4 changes: 4 additions & 0 deletions lib/workers/repository/process/extract-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ export async function extract(
for (const file of files) {
for (const dep of file.deps) {
delete dep.updates;
if (dep.skipStage && dep.skipStage !== 'extract') {
delete dep.skipReason;
delete dep.skipStage;
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions lib/workers/repository/process/fetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,21 @@ describe('workers/repository/process/fetch', () => {
depName: 'abcd',
packageName: 'abcd',
skipReason: 'ignored',
skipStage: 'lookup',
updates: [],
},
{
depName: 'foo',
packageName: 'foo',
skipReason: 'disabled',
skipStage: 'lookup',
updates: [],
},
{
depName: 'skipped',
packageName: 'skipped',
skipReason: 'some-reason',
skipStage: 'lookup',
updates: [],
},
],
Expand Down
3 changes: 3 additions & 0 deletions lib/workers/repository/process/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ export async function fetchUpdates(
deps = [];
packageDeps.set(packageFile, deps);
}
if (dep.skipReason && !dep.skipStage) {
dep.skipStage = 'lookup';
}
deps.push(dep);
} else {
errors.push(err);
Expand Down

0 comments on commit 07c0058

Please sign in to comment.