Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(automerge): force PR creation on dashboard approval #21924

Merged
merged 1 commit into from May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/workers/repository/update/pr/index.spec.ts
Expand Up @@ -396,6 +396,23 @@ describe('workers/repository/update/pr/index', () => {
expect(prCache.setPrCache).not.toHaveBeenCalled();
});

it('forces PR on dashboard check', async () => {
platform.createPr.mockResolvedValueOnce(pr);

const res = await ensurePr({
...config,
automerge: true,
automergeType: 'branch',
reviewers: ['somebody'],
dependencyDashboardChecks: {
'renovate-branch': 'approvePr',
},
});

expect(res).toEqual({ type: 'with-pr', pr });
expect(prCache.setPrCache).toHaveBeenCalled();
});

it('adds assignees for PR automerge with red status', async () => {
const changedPr: Pr = {
...pr,
Expand Down
7 changes: 6 additions & 1 deletion lib/workers/repository/update/pr/index.ts
Expand Up @@ -143,6 +143,11 @@ export async function ensurePr(
config.forcePr = true;
}

if (dependencyDashboardCheck === 'approvePr') {
logger.debug('Forcing PR because of dependency dashboard approval');
config.forcePr = true;
}

if (!existingPr) {
// Only create a PR if a branch automerge has failed
if (
Expand Down Expand Up @@ -172,7 +177,7 @@ export async function ensurePr(
return { type: 'without-pr', prBlockedBy: 'BranchAutomerge' };
}
}
if (!existingPr && config.prCreation === 'status-success') {
if (config.prCreation === 'status-success') {
rarkins marked this conversation as resolved.
Show resolved Hide resolved
logger.debug('Checking branch combined status');
if ((await getBranchStatus()) !== 'green') {
logger.debug(`Branch status isn't green - not creating PR`);
Expand Down