diff --git a/docs/usage/self-hosted-configuration.md b/docs/usage/self-hosted-configuration.md index 637623d077cb94e239d3d8220b327907942e3334..61fbb6e6d26669a74ba70f9fa8a7e11e41c8e9b9 100644 --- a/docs/usage/self-hosted-configuration.md +++ b/docs/usage/self-hosted-configuration.md @@ -623,10 +623,7 @@ Elements in the `repositories` array can be an object if you wish to define addi ```js { - repositories: [ - { repository: 'g/r1', bumpVersion: true }, - 'g/r2' - ], + repositories: [{ repository: 'g/r1', bumpVersion: true }, 'g/r2']; } ``` diff --git a/lib/modules/platform/azure/azure-helper.ts b/lib/modules/platform/azure/azure-helper.ts index 6accda1c731668cd07b1f846f371e329b3a19e3e..8369779fad547ea696c2c68386ba6f8a58f03681 100644 --- a/lib/modules/platform/azure/azure-helper.ts +++ b/lib/modules/platform/azure/azure-helper.ts @@ -5,11 +5,11 @@ import { } from 'azure-devops-node-api/interfaces/GitInterfaces.js'; import { logger } from '../../../logger'; import { streamToString } from '../../../util/streams'; +import { getNewBranchName } from '../util'; import * as azureApi from './azure-got-wrapper'; import { getBranchNameWithoutRefsPrefix, getBranchNameWithoutRefsheadsPrefix, - getNewBranchName, } from './util'; const mergePolicyGuid = 'fa4e907d-c16b-4a4c-9dfa-4916e5d171ab'; // Magic GUID for merge strategy policy configurations diff --git a/lib/modules/platform/azure/index.ts b/lib/modules/platform/azure/index.ts index 342dfcd599067a2a0c4d641ad3a0cbbd952ba4b2..51191062354e8afbd255b716ed4a54ba7b505e41 100644 --- a/lib/modules/platform/azure/index.ts +++ b/lib/modules/platform/azure/index.ts @@ -40,7 +40,7 @@ import type { RepoResult, UpdatePrConfig, } from '../types'; -import { repoFingerprint } from '../util'; +import { getNewBranchName, repoFingerprint } from '../util'; import { smartTruncate } from '../utils/pr-body'; import * as azureApi from './azure-got-wrapper'; import * as azureHelper from './azure-helper'; @@ -49,7 +49,6 @@ import { getBranchNameWithoutRefsheadsPrefix, getGitStatusContextCombinedName, getGitStatusContextFromCombinedName, - getNewBranchName, getProjectAndRepo, getRenovatePRFormat, getRepoByName, diff --git a/lib/modules/platform/azure/util.spec.ts b/lib/modules/platform/azure/util.spec.ts index ffa15a2d2fe770fd5cab133d16a6883f378b4393..567bc057e84e08aac069cacdd6399eda1277e25c 100644 --- a/lib/modules/platform/azure/util.spec.ts +++ b/lib/modules/platform/azure/util.spec.ts @@ -4,7 +4,6 @@ import { getBranchNameWithoutRefsheadsPrefix, getGitStatusContextCombinedName, getGitStatusContextFromCombinedName, - getNewBranchName, getProjectAndRepo, getRenovatePRFormat, getRepoByName, @@ -13,18 +12,6 @@ import { } from './util'; describe('modules/platform/azure/util', () => { - describe('getNewBranchName', () => { - it('should add refs/heads', () => { - const res = getNewBranchName('testBB'); - expect(res).toBe(`refs/heads/testBB`); - }); - - it('should be the same', () => { - const res = getNewBranchName('refs/heads/testBB'); - expect(res).toBe(`refs/heads/testBB`); - }); - }); - describe('getGitStatusContextCombinedName', () => { it('should return undefined if null context passed', () => { const contextName = getGitStatusContextCombinedName(null); diff --git a/lib/modules/platform/azure/util.ts b/lib/modules/platform/azure/util.ts index 660086b22a3c17a9e9f6eefc4972e1de30349bbd..8984ca01a138b9e26625d223dca2074a31a3ea06 100644 --- a/lib/modules/platform/azure/util.ts +++ b/lib/modules/platform/azure/util.ts @@ -12,13 +12,6 @@ import { toBase64 } from '../../../util/string'; import { getPrBodyStruct } from '../pr-body'; import type { AzurePr } from './types'; -export function getNewBranchName(branchName?: string): string | undefined { - if (branchName && !branchName.startsWith('refs/heads/')) { - return `refs/heads/${branchName}`; - } - return branchName; -} - export function getGitStatusContextCombinedName( context: GitStatusContext | null | undefined ): string | undefined { diff --git a/lib/modules/platform/util.spec.ts b/lib/modules/platform/util.spec.ts index 6cd8ae05ad0d7d181c3d18198e087fafb340d3f7..2299cf047af06e7775349c973e517045cdaa99e7 100644 --- a/lib/modules/platform/util.spec.ts +++ b/lib/modules/platform/util.spec.ts @@ -1,5 +1,5 @@ import * as hostRules from '../../util/host-rules'; -import { repoFingerprint } from './util'; +import { getNewBranchName, repoFingerprint } from './util'; describe('modules/platform/util', () => { beforeEach(() => hostRules.clear()); @@ -16,4 +16,16 @@ describe('modules/platform/util', () => { } ); }); + + describe('getNewBranchName', () => { + it('should add refs/heads', () => { + const res = getNewBranchName('testBB'); + expect(res).toBe(`refs/heads/testBB`); + }); + + it('should be the same', () => { + const res = getNewBranchName('refs/heads/testBB'); + expect(res).toBe(`refs/heads/testBB`); + }); + }); }); diff --git a/lib/modules/platform/util.ts b/lib/modules/platform/util.ts index fb7a10b766f5198eb5ffff4306f46f13b8e14f29..d074982889cbbdf475e4bb16f36c76cdbf3b38f3 100644 --- a/lib/modules/platform/util.ts +++ b/lib/modules/platform/util.ts @@ -8,3 +8,10 @@ export function repoFingerprint( const fingerprint = hasha(input); return fingerprint; } + +export function getNewBranchName(branchName?: string): string | undefined { + if (branchName && !branchName.startsWith('refs/heads/')) { + return `refs/heads/${branchName}`; + } + return branchName; +}