diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 2f27ba582f733c..afa89177db7aab 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -1432,6 +1432,16 @@ If you wish for Renovate to process only select paths in the repository, use `in Alternatively, if you need to just _exclude_ certain paths in the repository then consider `ignorePaths` instead. If you are more interested in including only certain package managers (e.g. `npm`), then consider `enabledManagers` instead. +## internalChecksAsSuccess + +By default, internal Renovate checks such as `renovate/stability-days` are not counted towards a branch being "green" or not. +This is primarily to prevent automerge when the only check is a passing Renovate check. + +Internal checks will always be counted/considered if they are in pending or failed states. +If there are multiple passing checks for a branch, including non-Renovate ones, then this setting won't make any difference. + +Change this setting to `true` if you want to use internal Renovate checks towards a passing branch result. + ## internalChecksFilter This setting determines whether Renovate controls when and how filtering of internal checks are performed, particularly when multiple versions of the same update type are available. diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index cfbe1b596ecb34..077276162487bb 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -1547,6 +1547,13 @@ const options: RenovateOptions[] = [ type: 'integer', default: 0, }, + { + name: 'internalChecksAsSuccess', + description: + 'Whether to consider passing internal checks such as stabilityDays when determining branch status.', + type: 'boolean', + default: false, + }, /* * Undocumented experimental feature { diff --git a/lib/config/types.ts b/lib/config/types.ts index d27accb2d48793..9891748ea53216 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -48,6 +48,7 @@ export interface RenovateSharedConfig { ignoreDeps?: string[]; ignorePaths?: string[]; ignoreTests?: boolean; + internalChecksAsSuccess?: boolean; labels?: string[]; addLabels?: string[]; dependencyDashboardApproval?: boolean; diff --git a/lib/modules/platform/azure/index.spec.ts b/lib/modules/platform/azure/index.spec.ts index 0767c3157ba400..74df14dd818684 100644 --- a/lib/modules/platform/azure/index.spec.ts +++ b/lib/modules/platform/azure/index.spec.ts @@ -577,10 +577,28 @@ describe('modules/platform/azure/index', () => { ]), } as any) ); - const res = await azure.getBranchStatus('somebranch'); + const res = await azure.getBranchStatus('somebranch', true); expect(res).toBe('green'); }); + it('should not treat internal checks as success', async () => { + await initRepo({ repository: 'some/repo' }); + azureApi.gitApi.mockImplementationOnce( + () => + ({ + getBranch: jest.fn(() => ({ commit: { commitId: 'abcd1234' } })), + getStatuses: jest.fn(() => [ + { + state: GitStatusState.Succeeded, + context: { genre: 'renovate' }, + }, + ]), + } as any) + ); + const res = await azure.getBranchStatus('somebranch', false); + expect(res).toBe('yellow'); + }); + it('should pass through failed', async () => { await initRepo({ repository: 'some/repo' }); azureApi.gitApi.mockImplementationOnce( @@ -590,7 +608,7 @@ describe('modules/platform/azure/index', () => { getStatuses: jest.fn(() => [{ state: GitStatusState.Error }]), } as any) ); - const res = await azure.getBranchStatus('somebranch'); + const res = await azure.getBranchStatus('somebranch', true); expect(res).toBe('red'); }); @@ -603,7 +621,7 @@ describe('modules/platform/azure/index', () => { getStatuses: jest.fn(() => [{ state: GitStatusState.Pending }]), } as any) ); - const res = await azure.getBranchStatus('somebranch'); + const res = await azure.getBranchStatus('somebranch', true); expect(res).toBe('yellow'); }); @@ -616,7 +634,7 @@ describe('modules/platform/azure/index', () => { getStatuses: jest.fn(() => []), } as any) ); - const res = await azure.getBranchStatus('somebranch'); + const res = await azure.getBranchStatus('somebranch', true); expect(res).toBe('yellow'); }); }); diff --git a/lib/modules/platform/azure/index.ts b/lib/modules/platform/azure/index.ts index e20acd9cf72f3d..2ddcc08a3dc834 100644 --- a/lib/modules/platform/azure/index.ts +++ b/lib/modules/platform/azure/index.ts @@ -381,7 +381,8 @@ export async function getBranchStatusCheck( } export async function getBranchStatus( - branchName: string + branchName: string, + internalChecksAsSuccess: boolean ): Promise { logger.debug(`getBranchStatus(${branchName})`); const statuses = await getStatusCheck(branchName); @@ -406,6 +407,19 @@ export async function getBranchStatus( if (noOfPending) { return 'yellow'; } + if ( + !internalChecksAsSuccess && + statuses.every( + (status) => + status.state === GitStatusState.Succeeded && + status.context?.genre === 'renovate' + ) + ) { + logger.debug( + 'Successful checks are all internal renovate/ checks, so returning "pending" branch status' + ); + return 'yellow'; + } return 'green'; } diff --git a/lib/modules/platform/bitbucket-server/index.spec.ts b/lib/modules/platform/bitbucket-server/index.spec.ts index 7b9b5a346321fa..6c8965a2ab87dd 100644 --- a/lib/modules/platform/bitbucket-server/index.spec.ts +++ b/lib/modules/platform/bitbucket-server/index.spec.ts @@ -1749,7 +1749,9 @@ Followed by some information. failed: 0, }); - expect(await bitbucket.getBranchStatus('somebranch')).toBe('green'); + expect(await bitbucket.getBranchStatus('somebranch', true)).toBe( + 'green' + ); }); it('should be pending', async () => { @@ -1764,7 +1766,9 @@ Followed by some information. failed: 0, }); - expect(await bitbucket.getBranchStatus('somebranch')).toBe('yellow'); + expect(await bitbucket.getBranchStatus('somebranch', true)).toBe( + 'yellow' + ); scope .get( @@ -1776,7 +1780,9 @@ Followed by some information. failed: 0, }); - expect(await bitbucket.getBranchStatus('somebranch')).toBe('yellow'); + expect(await bitbucket.getBranchStatus('somebranch', true)).toBe( + 'yellow' + ); }); it('should be failed', async () => { @@ -1791,7 +1797,9 @@ Followed by some information. failed: 1, }); - expect(await bitbucket.getBranchStatus('somebranch')).toBe('red'); + expect(await bitbucket.getBranchStatus('somebranch', true)).toBe( + 'red' + ); scope .get( @@ -1799,15 +1807,17 @@ Followed by some information. ) .replyWithError('requst-failed'); - expect(await bitbucket.getBranchStatus('somebranch')).toBe('red'); + expect(await bitbucket.getBranchStatus('somebranch', true)).toBe( + 'red' + ); }); it('throws repository-changed', async () => { git.branchExists.mockReturnValue(false); await initRepo(); - await expect(bitbucket.getBranchStatus('somebranch')).rejects.toThrow( - REPOSITORY_CHANGED - ); + await expect( + bitbucket.getBranchStatus('somebranch', true) + ).rejects.toThrow(REPOSITORY_CHANGED); }); }); diff --git a/lib/modules/platform/bitbucket/index.spec.ts b/lib/modules/platform/bitbucket/index.spec.ts index 6007fe9fdbcdcc..8724afef6c061e 100644 --- a/lib/modules/platform/bitbucket/index.spec.ts +++ b/lib/modules/platform/bitbucket/index.spec.ts @@ -225,7 +225,7 @@ describe('modules/platform/bitbucket/index', () => { }, ], }); - expect(await bitbucket.getBranchStatus('master')).toBe('red'); + expect(await bitbucket.getBranchStatus('master', true)).toBe('red'); }); it('getBranchStatus 4', async () => { @@ -250,7 +250,7 @@ describe('modules/platform/bitbucket/index', () => { }, ], }); - expect(await bitbucket.getBranchStatus('branch')).toBe('green'); + expect(await bitbucket.getBranchStatus('branch', true)).toBe('green'); }); it('getBranchStatus 5', async () => { @@ -275,7 +275,9 @@ describe('modules/platform/bitbucket/index', () => { }, ], }); - expect(await bitbucket.getBranchStatus('pending/branch')).toBe('yellow'); + expect(await bitbucket.getBranchStatus('pending/branch', true)).toBe( + 'yellow' + ); }); it('getBranchStatus 6', async () => { @@ -297,9 +299,34 @@ describe('modules/platform/bitbucket/index', () => { .reply(200, { values: [], }); - expect(await bitbucket.getBranchStatus('branch-with-empty-status')).toBe( - 'yellow' - ); + expect( + await bitbucket.getBranchStatus('branch-with-empty-status', true) + ).toBe('yellow'); + }); + + it('getBranchStatus 7', async () => { + const scope = await initRepoMock(); + scope + .get('/2.0/repositories/some/repo/refs/branches/branch') + .reply(200, { + name: 'branch', + target: { + hash: 'branch_hash', + parents: [{ hash: 'master_hash' }], + }, + }) + .get( + '/2.0/repositories/some/repo/commit/branch_hash/statuses?pagelen=100' + ) + .reply(200, { + values: [ + { + key: 'renovate/stability-days', + state: 'SUCCESSFUL', + }, + ], + }); + expect(await bitbucket.getBranchStatus('branch', false)).toBe('yellow'); }); }); diff --git a/lib/modules/platform/bitbucket/index.ts b/lib/modules/platform/bitbucket/index.ts index 9755dc18060d73..a4eaa4016a4093 100644 --- a/lib/modules/platform/bitbucket/index.ts +++ b/lib/modules/platform/bitbucket/index.ts @@ -355,7 +355,8 @@ async function getStatus( } // Returns the combined status for a branch. export async function getBranchStatus( - branchName: string + branchName: string, + internalChecksAsSuccess: boolean ): Promise { logger.debug(`getBranchStatus(${branchName})`); const statuses = await getStatus(branchName); @@ -377,6 +378,18 @@ export async function getBranchStatus( if (noOfPending) { return 'yellow'; } + if ( + !internalChecksAsSuccess && + statuses.every( + (status) => + status.state === 'SUCCESSFUL' && status.key?.startsWith('renovate/') + ) + ) { + logger.debug( + 'Successful checks are all internal renovate/ checks, so returning "pending" branch status' + ); + return 'yellow'; + } return 'green'; } diff --git a/lib/modules/platform/gitea/index.spec.ts b/lib/modules/platform/gitea/index.spec.ts index 060c7e57b111ef..5142b0d8299ff6 100644 --- a/lib/modules/platform/gitea/index.spec.ts +++ b/lib/modules/platform/gitea/index.spec.ts @@ -632,7 +632,7 @@ describe('modules/platform/gitea/index', () => { }) ); - return gitea.getBranchStatus('some-branch'); + return gitea.getBranchStatus('some-branch', true); }; it('should return yellow for unknown result', async () => { @@ -654,7 +654,7 @@ describe('modules/platform/gitea/index', () => { it('should abort when branch status returns 404', async () => { helper.getCombinedCommitStatus.mockRejectedValueOnce({ statusCode: 404 }); - await expect(gitea.getBranchStatus('some-branch')).rejects.toThrow( + await expect(gitea.getBranchStatus('some-branch', true)).rejects.toThrow( REPOSITORY_CHANGED ); }); @@ -664,10 +664,47 @@ describe('modules/platform/gitea/index', () => { new Error('getCombinedCommitStatus()') ); - await expect(gitea.getBranchStatus('some-branch')).rejects.toThrow( + await expect(gitea.getBranchStatus('some-branch', true)).rejects.toThrow( 'getCombinedCommitStatus()' ); }); + + it('should treat internal checks as success', async () => { + helper.getCombinedCommitStatus.mockResolvedValueOnce({ + worstStatus: 'success', + statuses: [ + { + id: 1, + status: 'success', + context: 'renovate/stability-days', + description: 'internal check', + target_url: '', + created_at: '', + }, + ], + }); + expect(await gitea.getBranchStatus('some-branch', true)).toBe('green'); + }); + + it('should not treat internal checks as success', async () => { + await initFakeRepo(); + helper.getCombinedCommitStatus.mockResolvedValueOnce( + partial({ + worstStatus: 'success', + statuses: [ + { + id: 1, + status: 'success', + context: 'renovate/stability-days', + description: 'internal check', + target_url: '', + created_at: '', + }, + ], + }) + ); + expect(await gitea.getBranchStatus('some-branch', false)).toBe('yellow'); + }); }); describe('getBranchStatusCheck', () => { diff --git a/lib/modules/platform/gitea/index.ts b/lib/modules/platform/gitea/index.ts index d650a6955104c0..3eff6f1ecb4770 100644 --- a/lib/modules/platform/gitea/index.ts +++ b/lib/modules/platform/gitea/index.ts @@ -387,7 +387,10 @@ const platform: Platform = { } }, - async getBranchStatus(branchName: string): Promise { + async getBranchStatus( + branchName: string, + internalChecksAsSuccess: boolean + ): Promise { let ccs: CombinedCommitStatus; try { ccs = await helper.getCombinedCommitStatus(config.repository, branchName); @@ -404,6 +407,17 @@ const platform: Platform = { } logger.debug({ ccs }, 'Branch status check result'); + if ( + !internalChecksAsSuccess && + ccs.worstStatus === 'success' && + ccs.statuses.every((status) => status.context?.startsWith('renovate/')) + ) { + logger.debug( + 'Successful checks are all internal renovate/ checks, so returning "pending" branch status' + ); + return 'yellow'; + } + return helper.giteaToRenovateStatusMapping[ccs.worstStatus] ?? 'yellow'; }, diff --git a/lib/modules/platform/github/index.spec.ts b/lib/modules/platform/github/index.spec.ts index acdf7859662641..bb9424ae581f74 100644 --- a/lib/modules/platform/github/index.spec.ts +++ b/lib/modules/platform/github/index.spec.ts @@ -998,10 +998,32 @@ describe('modules/platform/github/index', () => { .reply(200, []); await github.initRepo({ repository: 'some/repo' }); - const res = await github.getBranchStatus('somebranch'); + const res = await github.getBranchStatus('somebranch', true); expect(res).toBe('green'); }); + it('should not consider internal statuses as success', async () => { + const scope = httpMock.scope(githubApiHost); + initRepoMock(scope, 'some/repo'); + scope + .get('/repos/some/repo/commits/somebranch/status') + .reply(200, { + state: 'success', + statuses: [ + { + context: 'renovate/stability-days', + state: 'success', + }, + ], + }) + .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') + .reply(200, []); + + await github.initRepo({ repository: 'some/repo' }); + const res = await github.getBranchStatus('somebranch', false); + expect(res).toBe('yellow'); + }); + it('should pass through failed', async () => { const scope = httpMock.scope(githubApiHost); initRepoMock(scope, 'some/repo'); @@ -1014,7 +1036,7 @@ describe('modules/platform/github/index', () => { .reply(200, []); await github.initRepo({ repository: 'some/repo' }); - const res = await github.getBranchStatus('somebranch'); + const res = await github.getBranchStatus('somebranch', true); expect(res).toBe('red'); }); @@ -1029,7 +1051,7 @@ describe('modules/platform/github/index', () => { .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') .reply(200, []); await github.initRepo({ repository: 'some/repo' }); - const res = await github.getBranchStatus('somebranch'); + const res = await github.getBranchStatus('somebranch', true); expect(res).toBe('yellow'); }); @@ -1061,7 +1083,7 @@ describe('modules/platform/github/index', () => { ], }); await github.initRepo({ repository: 'some/repo' }); - const res = await github.getBranchStatus('somebranch'); + const res = await github.getBranchStatus('somebranch', true); expect(res).toBe('red'); }); @@ -1099,7 +1121,7 @@ describe('modules/platform/github/index', () => { ], }); await github.initRepo({ repository: 'some/repo' }); - const res = await github.getBranchStatus('somebranch'); + const res = await github.getBranchStatus('somebranch', true); expect(res).toBe('green'); }); @@ -1130,7 +1152,7 @@ describe('modules/platform/github/index', () => { ], }); await github.initRepo({ repository: 'some/repo' }); - const res = await github.getBranchStatus('somebranch'); + const res = await github.getBranchStatus('somebranch', true); expect(res).toBe('yellow'); }); }); diff --git a/lib/modules/platform/github/index.ts b/lib/modules/platform/github/index.ts index 7422d4a6ff93d0..caf65f1acb4c16 100644 --- a/lib/modules/platform/github/index.ts +++ b/lib/modules/platform/github/index.ts @@ -821,7 +821,8 @@ async function getStatus( // Returns the combined status for a branch. export async function getBranchStatus( - branchName: string + branchName: string, + internalChecksAsSuccess: boolean ): Promise { logger.debug(`getBranchStatus(${branchName})`); let commitStatus: CombinedBranchStatus; @@ -841,6 +842,18 @@ export async function getBranchStatus( { state: commitStatus.state, statuses: commitStatus.statuses }, 'branch status check result' ); + if (commitStatus.statuses && !internalChecksAsSuccess) { + commitStatus.statuses = commitStatus.statuses.filter( + (status) => + status.state !== 'success' || !status.context?.startsWith('renovate/') + ); + if (!commitStatus.statuses.length) { + logger.debug( + 'Successful checks are all internal renovate/ checks, so returning "pending" branch status' + ); + commitStatus.state = 'pending'; + } + } let checkRuns: { name: string; status: string; conclusion: string }[] = []; // API is supported in oldest available GHE version 2.19 try { diff --git a/lib/modules/platform/gitlab/index.spec.ts b/lib/modules/platform/gitlab/index.spec.ts index 4a1fe03a7d9de0..5990f566b0aeb2 100644 --- a/lib/modules/platform/gitlab/index.spec.ts +++ b/lib/modules/platform/gitlab/index.spec.ts @@ -532,7 +532,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('yellow'); }); @@ -574,7 +574,7 @@ describe('modules/platform/gitlab/index', () => { status: 'success', }, }); - const res = await gitlab.getBranchStatus('some-branch'); + const res = await gitlab.getBranchStatus('some-branch', true); expect(res).toBe('green'); }); @@ -592,10 +592,28 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('green'); }); + it('returns pending if all are internal success', async () => { + const scope = await initRepo(); + scope + .get( + '/api/v4/projects/some%2Frepo/repository/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e/statuses' + ) + .reply(200, [ + { name: 'renovate/stability-days', status: 'success' }, + { name: 'renovate/other', status: 'success' }, + ]) + .get( + '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' + ) + .reply(200, []); + const res = await gitlab.getBranchStatus('somebranch', false); + expect(res).toBe('yellow'); + }); + it('returns success if optional jobs fail', async () => { const scope = await initRepo(); scope @@ -610,7 +628,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('green'); }); @@ -625,7 +643,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('green'); }); @@ -640,7 +658,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('green'); }); @@ -655,7 +673,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('yellow'); }); @@ -670,7 +688,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('red'); }); @@ -689,7 +707,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('red'); }); @@ -704,7 +722,7 @@ describe('modules/platform/gitlab/index', () => { '/api/v4/projects/some%2Frepo/merge_requests?per_page=100&scope=created_by_me' ) .reply(200, []); - const res = await gitlab.getBranchStatus('somebranch'); + const res = await gitlab.getBranchStatus('somebranch', true); expect(res).toBe('yellow'); }); @@ -712,7 +730,7 @@ describe('modules/platform/gitlab/index', () => { expect.assertions(1); git.branchExists.mockReturnValue(false); await initRepo(); - await expect(gitlab.getBranchStatus('somebranch')).rejects.toThrow( + await expect(gitlab.getBranchStatus('somebranch', true)).rejects.toThrow( REPOSITORY_CHANGED ); }); diff --git a/lib/modules/platform/gitlab/index.ts b/lib/modules/platform/gitlab/index.ts index cf41c134d7dddc..98d034915baaff 100644 --- a/lib/modules/platform/gitlab/index.ts +++ b/lib/modules/platform/gitlab/index.ts @@ -396,7 +396,8 @@ const gitlabToRenovateStatusMapping: Record = { // Returns the combined status for a branch. export async function getBranchStatus( - branchName: string + branchName: string, + internalChecksAsSuccess: boolean ): Promise { logger.debug(`getBranchStatus(${branchName})`); @@ -428,6 +429,19 @@ export async function getBranchStatus( // Return 'pending' if we have no status checks return 'yellow'; } + if ( + !internalChecksAsSuccess && + branchStatuses.every( + (check) => + check.name?.startsWith('renovate/') && + gitlabToRenovateStatusMapping[check.status] === 'green' + ) + ) { + logger.debug( + 'Successful checks are all internal renovate/ checks, so returning "pending" branch status' + ); + return 'yellow'; + } let status: BranchStatus = 'green'; // default to green res .filter((check) => !check.allow_failure) diff --git a/lib/modules/platform/types.ts b/lib/modules/platform/types.ts index 07272f44987eba..f5f8a15285be67 100644 --- a/lib/modules/platform/types.ts +++ b/lib/modules/platform/types.ts @@ -204,7 +204,10 @@ export interface Platform { getPr(number: number): Promise; findPr(findPRConfig: FindPRConfig): Promise; refreshPr?(number: number): Promise; - getBranchStatus(branchName: string): Promise; + getBranchStatus( + branchName: string, + internalChecksAsSuccess: boolean + ): Promise; getBranchPr(branchName: string): Promise; initPlatform(config: PlatformParams): Promise; filterUnavailableUsers?(users: string[]): Promise; diff --git a/lib/workers/repository/update/branch/automerge.ts b/lib/workers/repository/update/branch/automerge.ts index 8d1339ad5013b3..8db027b4cc24f1 100644 --- a/lib/workers/repository/update/branch/automerge.ts +++ b/lib/workers/repository/update/branch/automerge.ts @@ -32,6 +32,7 @@ export async function tryBranchAutomerge( } const branchStatus = await resolveBranchStatus( config.branchName!, + !!config.internalChecksAsSuccess, config.ignoreTests ); if (branchStatus === 'green') { diff --git a/lib/workers/repository/update/branch/status-checks.spec.ts b/lib/workers/repository/update/branch/status-checks.spec.ts index bd2ba5bf5e7aec..93a811f14f4639 100644 --- a/lib/workers/repository/update/branch/status-checks.spec.ts +++ b/lib/workers/repository/update/branch/status-checks.spec.ts @@ -97,7 +97,7 @@ describe('workers/repository/update/branch/status-checks', () => { describe('getBranchStatus', () => { it('should return green if ignoreTests=true', async () => { - expect(await resolveBranchStatus('somebranch', true)).toBe('green'); + expect(await resolveBranchStatus('somebranch', true, true)).toBe('green'); }); }); }); diff --git a/lib/workers/repository/update/branch/status-checks.ts b/lib/workers/repository/update/branch/status-checks.ts index 361147de9ab53d..4fa6792ce6c7c5 100644 --- a/lib/workers/repository/update/branch/status-checks.ts +++ b/lib/workers/repository/update/branch/status-checks.ts @@ -9,6 +9,7 @@ import { export async function resolveBranchStatus( branchName: string, + internalChecksAsSuccess: boolean, ignoreTests = false ): Promise { logger.debug( @@ -20,7 +21,10 @@ export async function resolveBranchStatus( return 'green'; } - const status = await platform.getBranchStatus(branchName); + const status = await platform.getBranchStatus( + branchName, + internalChecksAsSuccess + ); logger.debug(`Branch status ${status}`); return status; diff --git a/lib/workers/repository/update/pr/automerge.ts b/lib/workers/repository/update/pr/automerge.ts index 486867a6308c20..66960c8f8e56af 100644 --- a/lib/workers/repository/update/pr/automerge.ts +++ b/lib/workers/repository/update/pr/automerge.ts @@ -69,6 +69,7 @@ export async function checkAutoMerge( } const branchStatus = await resolveBranchStatus( config.branchName, + !!config.internalChecksAsSuccess, config.ignoreTests ); if (branchStatus !== 'green') { diff --git a/lib/workers/repository/update/pr/index.ts b/lib/workers/repository/update/pr/index.ts index db1e0cbe9277a4..f333e266fce6a0 100644 --- a/lib/workers/repository/update/pr/index.ts +++ b/lib/workers/repository/update/pr/index.ts @@ -102,9 +102,15 @@ export async function ensurePr( const prFingerprint = fingerprint(filteredPrConfig); logger.trace({ config }, 'ensurePr'); // If there is a group, it will use the config of the first upgrade in the array - const { branchName, ignoreTests, prTitle = '', upgrades } = config; + const { + branchName, + ignoreTests, + internalChecksAsSuccess, + prTitle = '', + upgrades, + } = config; const getBranchStatus = memoize(() => - resolveBranchStatus(branchName, ignoreTests) + resolveBranchStatus(branchName, !!internalChecksAsSuccess, ignoreTests) ); const dependencyDashboardCheck = config.dependencyDashboardChecks?.[config.branchName];