mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
feat(config)!: change onboardingNoDeps from boolean
to enum
(#28133)
Change onboardingNoDeps from boolean to enum, with new default "auto". Auto means that Renovate will continue skipping repos with no dependencies if autodiscover is in use, but onboarding them if they are explicitly specified in a non-autodiscover mode. Closes #28101 BREAKING CHANGE: onboardingNoDeps changes from boolean to enum. Repositories with no dependencies will be onboarded unless in autodiscover mode.
This commit is contained in:
parent
b05f389c63
commit
0c500f52f2
8 changed files with 32 additions and 8 deletions
|
@ -273,7 +273,7 @@ To get a onboarding PR from Renovate, change to Interactive mode either at the R
|
|||
|
||||
#### Installing Renovate into selected repositories always leads to onboarding PRs
|
||||
|
||||
Additionally, if an Organization is installed with "Selected repositories" then the app will change `onboardingNoDeps` to `true` so that an Onboarding PR is created even if no dependencies are detected.
|
||||
Additionally, if an Organization is installed with "Selected repositories" then the app will change `onboardingNoDeps` to `"enabled"` so that an Onboarding PR is created even if no dependencies are detected.
|
||||
|
||||
### Fork Processing
|
||||
|
||||
|
|
|
@ -850,8 +850,12 @@ Falls back to `renovate.json` if the name provided is not valid.
|
|||
|
||||
## onboardingNoDeps
|
||||
|
||||
Set this to `true` if you want Renovate to create an onboarding PR even if no dependencies are found.
|
||||
Otherwise, Renovate skips onboarding a repository if it finds no dependencies in it.
|
||||
The default `auto` setting is converted to `disabled` if `autodiscoverRepositories` is `true`, or converted to `enabled` if false.
|
||||
|
||||
In other words, the default behavior is:
|
||||
|
||||
- If you run Renovate on discovered repositories then it will skip onboarding those without dependencies detected, but
|
||||
- If you run Renovate on _specific_ repositories then Renovate will onboard all such repositories even if no dependencies are found
|
||||
|
||||
## onboardingPrTitle
|
||||
|
||||
|
|
|
@ -207,8 +207,9 @@ const options: RenovateOptions[] = [
|
|||
{
|
||||
name: 'onboardingNoDeps',
|
||||
description: 'Onboard the repository even if no dependencies are found.',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
type: 'string',
|
||||
default: 'auto',
|
||||
allowedValues: ['auto', 'enabled', 'disabled'],
|
||||
globalOnly: true,
|
||||
inheritConfigSupport: true,
|
||||
},
|
||||
|
|
|
@ -178,7 +178,7 @@ export interface LegacyAdminConfig {
|
|||
onboarding?: boolean;
|
||||
onboardingBranch?: string;
|
||||
onboardingCommitMessage?: string;
|
||||
onboardingNoDeps?: boolean;
|
||||
onboardingNoDeps?: 'auto' | 'enabled' | 'disabled';
|
||||
onboardingRebaseCheckbox?: boolean;
|
||||
onboardingPrTitle?: string;
|
||||
onboardingConfig?: RenovateSharedConfig;
|
||||
|
|
|
@ -173,5 +173,18 @@ describe('workers/global/config/parse/index', () => {
|
|||
const parsed = await configParser.parseConfigs(defaultEnv, defaultArgv);
|
||||
expect(parsed).toContainEntries([['dryRun', null]]);
|
||||
});
|
||||
|
||||
it('massage onboardingNoDeps when autodiscover is false', async () => {
|
||||
jest.mock(
|
||||
'../../config.js',
|
||||
() => ({ onboardingNoDeps: 'auto', autodiscover: false }),
|
||||
{
|
||||
virtual: true,
|
||||
},
|
||||
);
|
||||
const env: NodeJS.ProcessEnv = {};
|
||||
const parsedConfig = await configParser.parseConfigs(env, defaultArgv);
|
||||
expect(parsedConfig).toContainEntries([['onboardingNoDeps', 'enabled']]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -113,6 +113,12 @@ export async function parseConfigs(
|
|||
config.forkProcessing = 'enabled';
|
||||
}
|
||||
|
||||
// Massage onboardingNoDeps
|
||||
if (!config.autodiscover && config.onboardingNoDeps !== 'disabled') {
|
||||
logger.debug('Enabling onboardingNoDeps while in non-autodiscover mode');
|
||||
config.onboardingNoDeps = 'enabled';
|
||||
}
|
||||
|
||||
// Remove log file entries
|
||||
delete config.logFile;
|
||||
delete config.logFileLevel;
|
||||
|
|
|
@ -59,7 +59,7 @@ describe('workers/repository/onboarding/branch/index', () => {
|
|||
});
|
||||
|
||||
it("doesn't throw if there are no package files and onboardingNoDeps config option is set", async () => {
|
||||
config.onboardingNoDeps = true;
|
||||
config.onboardingNoDeps = 'enabled';
|
||||
await expect(checkOnboardingBranch(config)).resolves.not.toThrow(
|
||||
REPOSITORY_NO_PACKAGE_FILES,
|
||||
);
|
||||
|
|
|
@ -108,7 +108,7 @@ export async function checkOnboardingBranch(
|
|||
Object.entries((await extractAllDependencies(mergedConfig)).packageFiles)
|
||||
.length === 0
|
||||
) {
|
||||
if (!config?.onboardingNoDeps) {
|
||||
if (config.onboardingNoDeps !== 'enabled') {
|
||||
throw new Error(REPOSITORY_NO_PACKAGE_FILES);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue