Skip to content

Commit

Permalink
return existing pr info when dryRun
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh committed Mar 25, 2023
1 parent 7953316 commit 780444f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/workers/repository/update/pr/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ describe('workers/repository/update/pr/index', () => {
});

it('dry-runs PR update', async () => {
const changedPr: Pr = { ...pr, title: 'Another title' }; // user changed prTitle
const changedPr: Pr = { ...pr, title: 'Another title' };
platform.getBranchPr.mockResolvedValueOnce(changedPr);

const res = await ensurePr(config);

expect(res).toEqual({ type: 'with-pr', pr }); // we redo the prTitle as per config
expect(res).toEqual({ type: 'with-pr', pr: changedPr });
expect(platform.updatePr).not.toHaveBeenCalled();
expect(platform.createPr).not.toHaveBeenCalled();
expect(logger.logger.info).toHaveBeenCalledWith(
Expand Down
1 change: 1 addition & 0 deletions lib/workers/repository/update/pr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export async function ensurePr(
}
if (GlobalConfig.get('dryRun')) {
logger.info(`DRY-RUN: Would update PR #${existingPr.number}`);
return { type: 'with-pr', pr: existingPr };
} else {
await platform.updatePr({
number: existingPr.number,
Expand Down

0 comments on commit 780444f

Please sign in to comment.