diff --git a/lib/platform/__snapshots__/index.spec.ts.snap b/lib/platform/__snapshots__/index.spec.ts.snap index 55090138c47f092212ed5d711dfbb127f74a778e..b7eb3bbe15110cec990a477d89d7c7b26da17449 100644 --- a/lib/platform/__snapshots__/index.spec.ts.snap +++ b/lib/platform/__snapshots__/index.spec.ts.snap @@ -6,7 +6,7 @@ Array [ "addReviewers", "branchExists", "cleanRepo", - "commitFilesToBranch", + "commitFiles", "createPr", "deleteBranch", "deleteLabel", @@ -51,7 +51,7 @@ Array [ "addReviewers", "branchExists", "cleanRepo", - "commitFilesToBranch", + "commitFiles", "createPr", "deleteBranch", "deleteLabel", @@ -96,7 +96,7 @@ Array [ "addReviewers", "branchExists", "cleanRepo", - "commitFilesToBranch", + "commitFiles", "createPr", "deleteBranch", "deleteLabel", @@ -141,7 +141,7 @@ Array [ "addReviewers", "branchExists", "cleanRepo", - "commitFilesToBranch", + "commitFiles", "createPr", "deleteBranch", "deleteLabel", diff --git a/lib/platform/azure/index.spec.ts b/lib/platform/azure/index.spec.ts index e01cc79edbd3db9207ae3189b3e97e48e0c92d2b..6054ba78dbbed72ab7689e2020289467444163a5 100644 --- a/lib/platform/azure/index.spec.ts +++ b/lib/platform/azure/index.spec.ts @@ -34,7 +34,7 @@ describe('platform/azure', () => { getAllRenovateBranches: jest.fn(), getCommitMessages: jest.fn(), getFile: jest.fn(), - commitFilesToBranch: jest.fn(), + commitFiles: jest.fn(), mergeBranch: jest.fn(), deleteBranch: jest.fn(), getRepoStatus: jest.fn(), diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index 8b98d93bf6dde87bc09779913ce27982ce106c73..cdfcb1cd981fe6485e3599f9453ee80df31ca33c 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -379,12 +379,12 @@ export /* istanbul ignore next */ function mergeBranch( return config.storage.mergeBranch(branchName); } -export /* istanbul ignore next */ function commitFilesToBranch({ +export /* istanbul ignore next */ function commitFiles({ branchName, files, message, }: CommitFilesConfig): Promise<string | null> { - return config.storage.commitFilesToBranch({ + return config.storage.commitFiles({ branchName, files, message, diff --git a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap index 35d7d34f24a908e890c32a8e2e62b3fd4a660e1e..9505c71697adfb21ed98854bebda7161f509c050 100644 --- a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap +++ b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap @@ -246,7 +246,7 @@ Array [ ] `; -exports[`platform/bitbucket-server endpoint with no path commitFilesToBranch() sends to gitFs 1`] = ` +exports[`platform/bitbucket-server endpoint with no path commitFiles() sends to gitFs 1`] = ` Array [ Array [ "./rest/api/1.0/projects/SOME/repos/repo", @@ -1825,7 +1825,7 @@ Array [ ] `; -exports[`platform/bitbucket-server endpoint with path commitFilesToBranch() sends to gitFs 1`] = ` +exports[`platform/bitbucket-server endpoint with path commitFiles() sends to gitFs 1`] = ` Array [ Array [ "./rest/api/1.0/projects/SOME/repos/repo", diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index 9dc79ed5a50f0c7e927e8a7304eb4f716d802d0e..84063f96c22340362a77aeea7b91301621ed366d 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -59,7 +59,7 @@ describe('platform/bitbucket-server', () => { getAllRenovateBranches: jest.fn(), getCommitMessages: jest.fn(), getFile: jest.fn(), - commitFilesToBranch: jest.fn(), + commitFiles: jest.fn(), mergeBranch: jest.fn(), deleteBranch: jest.fn(), getRepoStatus: jest.fn(), @@ -265,11 +265,11 @@ describe('platform/bitbucket-server', () => { }); }); - describe('commitFilesToBranch()', () => { + describe('commitFiles()', () => { it('sends to gitFs', async () => { expect.assertions(1); await initRepo(); - await bitbucket.commitFilesToBranch({ + await bitbucket.commitFiles({ branchName: 'some-branch', files: [{ name: 'test', contents: 'dummy' }], message: 'message', diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index f5d83c27ae379dc066dccd5d1d6d7f3f93eaafcb..60f141ada746cb84388323a1107e28e7ba22c7ed 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -426,13 +426,13 @@ export function getAllRenovateBranches( return config.storage.getAllRenovateBranches(branchPrefix); } -export async function commitFilesToBranch({ +export async function commitFiles({ branchName, files, message, }: CommitFilesConfig): Promise<string | null> { logger.debug( - `commitFilesToBranch(${JSON.stringify( + `commitFiles(${JSON.stringify( { branchName, filesLength: files.length, @@ -442,7 +442,7 @@ export async function commitFilesToBranch({ 2 )})` ); - const commit = config.storage.commitFilesToBranch({ + const commit = config.storage.commitFiles({ branchName, files, message, diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts index a6bd99e995803fc6f5c5e0e320ccc796edb8bf40..60af57c35d2d17f6b9d109d758118e7f63d55dc1 100644 --- a/lib/platform/bitbucket/index.spec.ts +++ b/lib/platform/bitbucket/index.spec.ts @@ -34,7 +34,7 @@ describe('platform/bitbucket', () => { getAllRenovateBranches: jest.fn(), getCommitMessages: jest.fn(), getFile: jest.fn(), - commitFilesToBranch: jest.fn(), + commitFiles: jest.fn(), mergeBranch: jest.fn(), deleteBranch: jest.fn(), getRepoStatus: jest.fn(), @@ -486,11 +486,11 @@ describe('platform/bitbucket', () => { }); }); - describe('commitFilesToBranch()', () => { + describe('commitFiles()', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.commitFilesToBranch({ + await bitbucket.commitFiles({ branchName: 'test', files: [], message: 'message', diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts index 2ec87005bd6e8d2f6ce166cfce0c9596db93e47c..68d6380f838f1e9b888479f7b544439e99f793ae 100644 --- a/lib/platform/bitbucket/index.ts +++ b/lib/platform/bitbucket/index.ts @@ -288,12 +288,12 @@ export function mergeBranch(branchName: string): Promise<void> { return config.storage.mergeBranch(branchName); } -export function commitFilesToBranch({ +export function commitFiles({ branchName, files, message, }: CommitFilesConfig): Promise<string | null> { - return config.storage.commitFilesToBranch({ + return config.storage.commitFiles({ branchName, files, message, diff --git a/lib/platform/common.ts b/lib/platform/common.ts index a270c2383c55bbb5e979d1d8c231500b8f26be32..285dde288589d837cd74a855ef4c748da7c055dd 100644 --- a/lib/platform/common.ts +++ b/lib/platform/common.ts @@ -223,7 +223,7 @@ export interface Platform { ensureComment(ensureComment: EnsureCommentConfig): Promise<boolean>; branchExists(branchName: string): Promise<boolean>; setBaseBranch(baseBranch?: string): Promise<string>; - commitFilesToBranch(commitFile: CommitFilesConfig): Promise<string | null>; + commitFiles(commitFile: CommitFilesConfig): Promise<string | null>; getPr(number: number): Promise<Pr>; findPr(findPRConfig: FindPRConfig): Promise<Pr>; mergeBranch(branchName: string): Promise<void>; diff --git a/lib/platform/git/storage.spec.ts b/lib/platform/git/storage.spec.ts index 01a035519d27d9475dae12623d732aeb227ab0f8..432f5b15089f7b5064de73f993cadd7f4c3f5262 100644 --- a/lib/platform/git/storage.spec.ts +++ b/lib/platform/git/storage.spec.ts @@ -195,13 +195,13 @@ describe('platform/git/storage', () => { ).rejects.toMatchSnapshot(); }); }); - describe('commitFilesToBranch({branchName, files, message})', () => { + describe('commitFiles({branchName, files, message})', () => { it('creates file', async () => { const file = { name: 'some-new-file', contents: 'some new-contents', }; - await git.commitFilesToBranch({ + await git.commitFiles({ branchName: 'renovate/past_branch', files: [file], message: 'Create something', @@ -212,7 +212,7 @@ describe('platform/git/storage', () => { name: '|delete|', contents: 'file_to_delete', }; - await git.commitFilesToBranch({ + await git.commitFiles({ branchName: 'renovate/something', files: [file], message: 'Delete something', @@ -229,7 +229,7 @@ describe('platform/git/storage', () => { contents: 'other updated content', }, ]; - await git.commitFilesToBranch({ + await git.commitFiles({ branchName: 'renovate/something', files, message: 'Update something', @@ -242,7 +242,7 @@ describe('platform/git/storage', () => { contents: 'some content', }, ]; - await git.commitFilesToBranch({ + await git.commitFiles({ branchName: 'renovate/something', files, message: 'Update something', @@ -257,7 +257,7 @@ describe('platform/git/storage', () => { `refs/heads/${branchName}:refs/remotes/origin/${branchName}`, ]); const files = []; - await git.commitFilesToBranch({ + await git.commitFiles({ branchName, files, message: 'Update something', diff --git a/lib/platform/git/storage.ts b/lib/platform/git/storage.ts index 19fe8d6692f77488874f4006433eaa57f0492bd9..b3253f1b3ef0d535e44fac3f77d102803680a71a 100644 --- a/lib/platform/git/storage.ts +++ b/lib/platform/git/storage.ts @@ -464,7 +464,7 @@ export class Storage { } } - async commitFilesToBranch({ + async commitFiles({ branchName, files, message, diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index e9724382eb3c2edd7f048ba9b66c130260507ebc..b5e08d546983e6932dda89a895efec4e3e27c034 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -201,7 +201,7 @@ describe('platform/gitea', () => { setBranchPrefix: gsmSetBranchPrefix, isBranchStale: gsmIsBranchStale, getBranchCommit: gsmGetBranchCommit, - commitFilesToBranch: gsmCommitFilesToBranch, + commitFiles: gsmCommitFilesToBranch, deleteBranch: gsmDeleteBranch, })); @@ -1439,7 +1439,7 @@ index 0000000..2173594 }); }); - describe('commitFilesToBranch', () => { + describe('commitFiles', () => { it('should propagate call to storage class with default parent branch', async () => { const commitConfig: CommitFilesConfig = { branchName: 'some-branch', @@ -1448,7 +1448,7 @@ index 0000000..2173594 }; await initFakeRepo(); - await gitea.commitFilesToBranch(commitConfig); + await gitea.commitFiles(commitConfig); expect(gsmCommitFilesToBranch).toHaveBeenCalledTimes(1); expect(gsmCommitFilesToBranch).toHaveBeenCalledWith({ diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index a3c70bcb1014b98048a5b653ae85eb20c64fb283..5e9ce871b83a03a076c7f6ae6b72119a44f7724f 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -887,12 +887,12 @@ const platform: Platform = { return Promise.resolve(); }, - commitFilesToBranch({ + commitFiles({ branchName, files, message, }: CommitFilesConfig): Promise<string | null> { - return config.storage.commitFilesToBranch({ + return config.storage.commitFiles({ branchName, files, message, @@ -962,7 +962,7 @@ export const { addReviewers, branchExists, cleanRepo, - commitFilesToBranch, + commitFiles, createPr, deleteBranch, deleteLabel, diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index bf32b2283d6a37544079a31f37d005d6251aa53c..f617748be4c8e78f7d07ca61d749101c59b94631 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -39,7 +39,7 @@ describe('platform/github', () => { getAllRenovateBranches: jest.fn(), getCommitMessages: jest.fn(), getFile: jest.fn(), - commitFilesToBranch: jest.fn(), + commitFiles: jest.fn(), mergeBranch: jest.fn(), deleteBranch: jest.fn(), getRepoStatus: jest.fn(), diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 9187981ea806a409efcb3eb74e80dec29c9c69d1..5a1a47f5d2877162281c36e3228aa6f58a846755 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -554,12 +554,12 @@ export function mergeBranch(branchName: string): Promise<void> { } // istanbul ignore next -export function commitFilesToBranch({ +export function commitFiles({ branchName, files, message, }: CommitFilesConfig): Promise<string | null> { - return config.storage.commitFilesToBranch({ + return config.storage.commitFiles({ branchName, files, message, diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index 2bd3fde109daf0da1b1be760cef7184544f4ab87..0f7f181e81b6f207fc9b7eb75fe76e082675bfcc 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -27,7 +27,7 @@ Array [ ] `; -exports[`platform/gitlab commitFilesToBranch() sends to gitFs 1`] = ` +exports[`platform/gitlab commitFiles() sends to gitFs 1`] = ` Array [ Array [ "projects/some%2Frepo", diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index 40f748ca9f8cde3ca93b086c68ea2787ac2a9d23..6fe998e3d1628db87967d2133bc14ddbef33e32e 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -41,7 +41,7 @@ describe('platform/gitlab', () => { getAllRenovateBranches: jest.fn(), getCommitMessages: jest.fn(), getFile: jest.fn(), - commitFilesToBranch: jest.fn(), + commitFiles: jest.fn(), mergeBranch: jest.fn(), deleteBranch: jest.fn(), getRepoStatus: jest.fn(), @@ -1142,11 +1142,11 @@ These updates have all been created already. Click a checkbox below to force a r await gitlab.getFile(''); }); }); - describe('commitFilesToBranch()', () => { + describe('commitFiles()', () => { it('sends to gitFs', async () => { expect.assertions(1); await initRepo(); - await gitlab.commitFilesToBranch({ + await gitlab.commitFiles({ branchName: 'some-branch', files: [{ name: 'SomeFile', contents: 'Some Content' }], message: '', diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 9208cfdf1aa5668de12057d036e5c41ab634071f..bbfcfc600d7fc2ad3fa9aaae8ac99c7d1159e078 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -587,12 +587,12 @@ export function isBranchStale(branchName: string): Promise<boolean> { return config.storage.isBranchStale(branchName); } -export function commitFilesToBranch({ +export function commitFiles({ branchName, files, message, }: CommitFilesConfig): Promise<string | null> { - return config.storage.commitFilesToBranch({ + return config.storage.commitFiles({ branchName, files, message, diff --git a/lib/workers/branch/commit.spec.ts b/lib/workers/branch/commit.spec.ts index cd68fe7772525b022423bbb11167be02eeba47d1..d654a6b98fd1dbee6c69c5cd8effdf53d0546124 100644 --- a/lib/workers/branch/commit.spec.ts +++ b/lib/workers/branch/commit.spec.ts @@ -17,11 +17,11 @@ describe('workers/branch/automerge', () => { updatedArtifacts: [], }); jest.resetAllMocks(); - platform.commitFilesToBranch.mockResolvedValueOnce('abc123'); + platform.commitFiles.mockResolvedValueOnce('abc123'); }); it('handles empty files', async () => { await commitFilesToBranch(config); - expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(0); + expect(platform.commitFiles).toHaveBeenCalledTimes(0); }); it('commits files', async () => { config.updatedPackageFiles.push({ @@ -29,8 +29,8 @@ describe('workers/branch/automerge', () => { contents: 'some contents', }); await commitFilesToBranch(config); - expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(1); - expect(platform.commitFilesToBranch.mock.calls).toMatchSnapshot(); + expect(platform.commitFiles).toHaveBeenCalledTimes(1); + expect(platform.commitFiles.mock.calls).toMatchSnapshot(); }); it('dry runs', async () => { config.dryRun = true; @@ -39,7 +39,7 @@ describe('workers/branch/automerge', () => { contents: 'some contents', }); await commitFilesToBranch(config); - expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(0); + expect(platform.commitFiles).toHaveBeenCalledTimes(0); }); }); }); diff --git a/lib/workers/branch/commit.ts b/lib/workers/branch/commit.ts index 86f71984d16e477b8e3f1d5b447a81a170c8acf0..13f06692a7a2e058fe555a63674c6b80e22470c5 100644 --- a/lib/workers/branch/commit.ts +++ b/lib/workers/branch/commit.ts @@ -33,7 +33,7 @@ export async function commitFilesToBranch( return null; } // API will know whether to create new branch or not - return platform.commitFilesToBranch({ + return platform.commitFiles({ branchName: config.branchName, files: updatedFiles, message: config.commitMessage, diff --git a/lib/workers/repository/onboarding/branch/create.ts b/lib/workers/repository/onboarding/branch/create.ts index fd43e4d9e7aa75b86130c782d654c11cc722615f..ad8b8afcb4119d2ee0f5e8951d173d4f6b76fdd7 100644 --- a/lib/workers/repository/onboarding/branch/create.ts +++ b/lib/workers/repository/onboarding/branch/create.ts @@ -29,7 +29,7 @@ export async function createOnboardingBranch( logger.info('DRY-RUN: Would commit files to onboarding branch'); return null; } - return platform.commitFilesToBranch({ + return platform.commitFiles({ branchName: config.onboardingBranch, files: [ { diff --git a/lib/workers/repository/onboarding/branch/index.spec.ts b/lib/workers/repository/onboarding/branch/index.spec.ts index 7c9502a47fd03ac876b61130de3d7303da8e9604..a9d53d2703ac9eb08b4e4f39a05b77973fef14eb 100644 --- a/lib/workers/repository/onboarding/branch/index.spec.ts +++ b/lib/workers/repository/onboarding/branch/index.spec.ts @@ -35,7 +35,7 @@ describe('workers/repository/onboarding/branch', () => { fs.readLocalFile.mockResolvedValue('{}'); await checkOnboardingBranch(config); expect( - platform.commitFilesToBranch.mock.calls[0][0].files[0].contents + platform.commitFiles.mock.calls[0][0].files[0].contents ).toMatchSnapshot(); }); it('handles skipped onboarding combined with requireConfig = false', async () => { @@ -100,10 +100,10 @@ describe('workers/repository/onboarding/branch', () => { }, }); fs.readLocalFile.mockResolvedValue(pJsonContent); - platform.commitFilesToBranch.mockResolvedValueOnce('abc123'); + platform.commitFiles.mockResolvedValueOnce('abc123'); await checkOnboardingBranch(config); expect( - platform.commitFilesToBranch.mock.calls[0][0].files[0].contents + platform.commitFiles.mock.calls[0][0].files[0].contents ).toMatchSnapshot(); }); it('updates onboarding branch', async () => { @@ -115,7 +115,7 @@ describe('workers/repository/onboarding/branch', () => { expect(res.repoIsOnboarded).toBe(false); expect(res.branchList).toEqual(['renovate/configure']); expect(platform.setBaseBranch).toHaveBeenCalledTimes(1); - expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(0); + expect(platform.commitFiles).toHaveBeenCalledTimes(0); }); }); }); diff --git a/lib/workers/repository/onboarding/branch/rebase.spec.ts b/lib/workers/repository/onboarding/branch/rebase.spec.ts index 897106a99752a89533ff81f8599a31fb86bfe980..fda34695fac44701f0771a9e75fd404ac87a85a4 100644 --- a/lib/workers/repository/onboarding/branch/rebase.spec.ts +++ b/lib/workers/repository/onboarding/branch/rebase.spec.ts @@ -22,7 +22,7 @@ describe('workers/repository/onboarding/branch/rebase', () => { isModified: true, }); await rebaseOnboardingBranch(config); - expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(0); + expect(platform.commitFiles).toHaveBeenCalledTimes(0); }); it('does nothing if branch is up to date', async () => { const contents = @@ -36,7 +36,7 @@ describe('workers/repository/onboarding/branch/rebase', () => { isStale: false, }); await rebaseOnboardingBranch(config); - expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(0); + expect(platform.commitFiles).toHaveBeenCalledTimes(0); }); it('rebases onboarding branch', async () => { platform.getBranchPr.mockResolvedValueOnce({ @@ -45,7 +45,7 @@ describe('workers/repository/onboarding/branch/rebase', () => { isModified: false, }); await rebaseOnboardingBranch(config); - expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(1); + expect(platform.commitFiles).toHaveBeenCalledTimes(1); }); }); }); diff --git a/lib/workers/repository/onboarding/branch/rebase.ts b/lib/workers/repository/onboarding/branch/rebase.ts index 50d7965a0e77835368ca9427b8ac5bc0c1945bad..445ac440cc0d92effc05d9751778b88e6383a36f 100644 --- a/lib/workers/repository/onboarding/branch/rebase.ts +++ b/lib/workers/repository/onboarding/branch/rebase.ts @@ -49,7 +49,7 @@ export async function rebaseOnboardingBranch( logger.info('DRY-RUN: Would rebase files in onboarding branch'); return null; } - return platform.commitFilesToBranch({ + return platform.commitFiles({ branchName: config.onboardingBranch, files: [ {