mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix(core/automerge): care only about automergeSchedule when branch exists (#23561)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: Rhys Arkins <rhys@arkins.net>
This commit is contained in:
parent
2367b42413
commit
7949a2afee
3 changed files with 31 additions and 2 deletions
|
@ -190,6 +190,10 @@ So for example you could choose to automerge all (passing) `devDependencies` onl
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
!!! note
|
||||||
|
Branches creation follows [`schedule`](#schedule) and the automerge follows [`automergeSchedule`](#automergeschedule).
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
!!! warning "Negative reviews on GitHub block Renovate automerge"
|
!!! warning "Negative reviews on GitHub block Renovate automerge"
|
||||||
Renovate won't automerge on GitHub if a PR has a negative review.
|
Renovate won't automerge on GitHub if a PR has a negative review.
|
||||||
|
|
|
@ -610,6 +610,29 @@ describe('workers/repository/update/branch/index', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// automerge should respect only automergeSchedule
|
||||||
|
// mock a case where branchPr does not exist, pr-creation is off-schedule, and the branch is configured for automerge
|
||||||
|
it('automerges when there is no pr and, pr-creation is off-schedule', async () => {
|
||||||
|
schedule.isScheduledNow.mockReturnValueOnce(false);
|
||||||
|
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce(
|
||||||
|
partial<PackageFilesResult>({
|
||||||
|
updatedPackageFiles: [partial<FileChange>()],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
npmPostExtract.getAdditionalFiles.mockResolvedValueOnce({
|
||||||
|
artifactErrors: [],
|
||||||
|
updatedArtifacts: [partial<FileChange>()],
|
||||||
|
});
|
||||||
|
scm.branchExists.mockResolvedValue(true);
|
||||||
|
commit.commitFilesToBranch.mockResolvedValueOnce(null);
|
||||||
|
automerge.tryBranchAutomerge.mockResolvedValueOnce('automerged');
|
||||||
|
config.automerge = true;
|
||||||
|
config.automergeType = 'branch';
|
||||||
|
await branchWorker.processBranch(config);
|
||||||
|
expect(automerge.tryBranchAutomerge).toHaveBeenCalledTimes(1);
|
||||||
|
expect(prWorker.ensurePr).toHaveBeenCalledTimes(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('returns if branch automerged', async () => {
|
it('returns if branch automerged', async () => {
|
||||||
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce(
|
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce(
|
||||||
partial<PackageFilesResult>({
|
partial<PackageFilesResult>({
|
||||||
|
|
|
@ -309,8 +309,10 @@ export async function processBranch(
|
||||||
result: 'update-not-scheduled',
|
result: 'update-not-scheduled',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// istanbul ignore if
|
if (
|
||||||
if (!branchPr) {
|
!branchPr &&
|
||||||
|
!(config.automerge && config.automergeType === 'branch') // if branch is configured for automerge there's no need for a PR
|
||||||
|
) {
|
||||||
logger.debug('Skipping PR creation out of schedule');
|
logger.debug('Skipping PR creation out of schedule');
|
||||||
return {
|
return {
|
||||||
branchExists,
|
branchExists,
|
||||||
|
|
Loading…
Reference in a new issue