From 67e3825f42e977c8a3aa3362103c9adfbbc70c53 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 31 Dec 2018 07:46:00 +0200 Subject: [PATCH] refactor: renovateFork -> includeForks --- docs/local-development.md | 4 ++-- lib/config/cli.js | 1 + lib/config/definitions.js | 5 +++-- lib/config/migration.js | 4 ++++ lib/platform/github/index.js | 6 +++--- lib/workers/repository/configured.js | 2 +- lib/workers/repository/onboarding/branch/index.js | 2 +- test/config/__snapshots__/migration.spec.js.snap | 1 + test/config/migration.spec.js | 1 + website/docs/configuration-options.md | 8 ++++---- 10 files changed, 21 insertions(+), 13 deletions(-) diff --git a/docs/local-development.md b/docs/local-development.md index 73cb917dd0..ee25e1ca2c 100644 --- a/docs/local-development.md +++ b/docs/local-development.md @@ -91,9 +91,9 @@ Then, make sure your fork is up to date with `master` each time before creating Quite often, the quickest way for you to test or fix something is to fork an existing repository. However, by default Renovate skips over repositories that are forked. -To override this default, you need to specify the setting `renovateFork` as `true`. +To override this default, you need to specify the setting `includeForks` as `true`. -Option 1: Add `"renovateFork": true` to the `renovate.json` of the repository +Option 1: Add `"includeForks": true` to the `renovate.json` of the repository Option 2: Run Renovate with the CLI flag `--renovate-fork=true` #### Log files diff --git a/lib/config/cli.js b/lib/config/cli.js index c85db9b4fa..f325a913c2 100644 --- a/lib/config/cli.js +++ b/lib/config/cli.js @@ -22,6 +22,7 @@ function getConfig(input) { .replace('--endpoints=', '--host-rules=') .replace('--expose-env=true', '--trust-level=high') .replace('--expose-env', '--trust-level=high') + .replace('--renovate-fork', '--include-forks') ); const options = configDefinitions.getOptions(); diff --git a/lib/config/definitions.js b/lib/config/definitions.js index 2d3ef2343d..bf8be0af08 100644 --- a/lib/config/definitions.js +++ b/lib/config/definitions.js @@ -112,8 +112,9 @@ const options = [ cli: false, }, { - name: 'renovateFork', - description: 'Whether to renovate a forked repository or not.', + name: 'includeForks', + description: + 'Whether to process forked repositories or not. By default, all forked repositories are skipped over.', stage: 'repository', type: 'boolean', default: false, diff --git a/lib/config/migration.js b/lib/config/migration.js index 7d553de37f..7cccc0b78e 100644 --- a/lib/config/migration.js +++ b/lib/config/migration.js @@ -167,6 +167,10 @@ function migrateConfig(config) { isMigrated = true; delete migratedConfig.multipleMajorPrs; migratedConfig.separateMultipleMajor = val; + } else if (key === 'renovateFork') { + isMigrated = true; + delete migratedConfig.renovateFork; + migratedConfig.includeForks = val; } else if (key === 'separateMajorReleases') { isMigrated = true; delete migratedConfig.separateMultipleMajor; diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index d21e96416f..2ed7dd0c94 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -114,7 +114,7 @@ async function initRepo({ gitPrivateKey, gitFs, localDir, - renovateFork, + includeForks, }) { logger.debug(`initRepo("${repository}")`); logger.info( @@ -152,7 +152,7 @@ async function initRepo({ res = await get(`repos/${repository}`); logger.trace({ repositoryDetails: res.body }, 'Repository details'); // istanbul ignore if - if (res.body.fork && gitFs && !renovateFork) { + if (res.body.fork && gitFs && !includeForks) { try { const renovateConfig = JSON.parse( Buffer.from( @@ -161,7 +161,7 @@ async function initRepo({ 'base64' ).toString() ); - if (!renovateConfig.renovateFork) { + if (!renovateConfig.includeForks) { throw new Error(); } } catch (err) { diff --git a/lib/workers/repository/configured.js b/lib/workers/repository/configured.js index a758ed2759..df772c4fd6 100644 --- a/lib/workers/repository/configured.js +++ b/lib/workers/repository/configured.js @@ -6,7 +6,7 @@ function checkIfConfigured(config) { if (config.enabled === false) { throw new Error('disabled'); } - if (config.isFork && !config.renovateFork) { + if (config.isFork && !config.includeForks) { throw new Error('fork'); } } diff --git a/lib/workers/repository/onboarding/branch/index.js b/lib/workers/repository/onboarding/branch/index.js index dca69c9e73..3f0e8b2f2a 100644 --- a/lib/workers/repository/onboarding/branch/index.js +++ b/lib/workers/repository/onboarding/branch/index.js @@ -11,7 +11,7 @@ async function checkOnboardingBranch(config) { logger.debug('Repo is onboarded'); return { ...config, repoIsOnboarded }; } - if (config.isFork && !config.renovateFork) { + if (config.isFork && !config.includeForks) { throw new Error('fork'); } logger.info('Repo is not onboarded'); diff --git a/test/config/__snapshots__/migration.spec.js.snap b/test/config/__snapshots__/migration.spec.js.snap index 3bbeb5c14b..f5e59e0f9e 100644 --- a/test/config/__snapshots__/migration.spec.js.snap +++ b/test/config/__snapshots__/migration.spec.js.snap @@ -28,6 +28,7 @@ Object { "ignorePaths": Array [ "node_modules/", ], + "includeForks": true, "lockFileMaintenance": Object { "automerge": true, "gitFs": "https", diff --git a/test/config/migration.spec.js b/test/config/migration.spec.js index 5078069a91..771bf5b29b 100644 --- a/test/config/migration.spec.js +++ b/test/config/migration.spec.js @@ -21,6 +21,7 @@ describe('config/migration', () => { upgradeInRange: true, automergeType: 'branch-push', baseBranch: 'next', + renovateFork: true, ignoreNodeModules: true, node: { enabled: true, diff --git a/website/docs/configuration-options.md b/website/docs/configuration-options.md index ed120aac41..8153ed69f9 100644 --- a/website/docs/configuration-options.md +++ b/website/docs/configuration-options.md @@ -304,6 +304,10 @@ By default, Renovate won't update any package versions to unstable versions (e.g Also check out the `followTag` configuration option above if you wish Renovate to keep you pinned to a particular release tag. +## includeForks + +By default, the bot will skip over any repositories that are forked, even if they contain a config file, because that config may have been from the source repository anyway. To enable processing of a forked repository, you need to add `includeForks: true` to your config or run the CLI command with `--include-forks`. + ## includePaths If you wish for Renovate to process only select paths in the repository, use `includePaths`. @@ -789,10 +793,6 @@ Typically you shouldn't need to modify this setting. This is only necessary in case you need to manually configure a registry URL to use for datasource lookups. Applies to PyPI (pip) only for now. Supports only one URL for now but is defined as a list for forward compatibility. -## renovateFork - -By default, Renovate will skip over any repositories that are forked, even if they contain a `renovate.json`, because that config may have been from the source repository. To enable Renovate on forked repositories, you need to add `renovateFork: true` to your renovate config. - ## requiredStatusChecks This is a future feature that is partially implemented. Currently Renovate's default behaviour is to only automerge if every status check has succeeded. In future, this might be configurable to allow certain status checks to be ignored. -- GitLab