Skip to content

Commit 7373eae

Browse files
ZackKanterclaude
andauthored
chore(logging): include PR number when detecting existing branch PR (renovatebot#40832)
feat(logging): include PR number when detecting existing branch PR Include the PR number in debug log messages when: - An existing open branch PR is found ("Found existing branch PR #123") - A closed PR already exists ("Closed PR #123 already exists") This aids debugging by making it easier to correlate log entries with specific PRs when reviewing Renovate logs. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8dfe853 commit 7373eae

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/workers/repository/update/branch/index.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,6 +2839,7 @@ describe('workers/repository/update/branch/index', () => {
28392839
scm.branchExists.mockResolvedValueOnce(true);
28402840
platform.getBranchPr.mockResolvedValueOnce(
28412841
partial<Pr>({
2842+
number: 5,
28422843
sourceBranch: 'old/some-branch',
28432844
state: 'open',
28442845
}),
@@ -2858,7 +2859,7 @@ describe('workers/repository/update/branch/index', () => {
28582859
commitSha: '123test',
28592860
});
28602861

2861-
expect(logger.debug).toHaveBeenCalledWith('Found existing branch PR');
2862+
expect(logger.debug).toHaveBeenCalledWith('Found existing branch PR #5');
28622863

28632864
expect(logger.debug).toHaveBeenCalledWith(
28642865
'No package files need updating',
@@ -2877,6 +2878,7 @@ describe('workers/repository/update/branch/index', () => {
28772878
scm.branchExists.mockResolvedValueOnce(true);
28782879
platform.getBranchPr.mockResolvedValueOnce(
28792880
partial<Pr>({
2881+
number: 5,
28802882
sourceBranch: 'old/some-branch',
28812883
state: 'open',
28822884
}),
@@ -2897,7 +2899,7 @@ describe('workers/repository/update/branch/index', () => {
28972899
commitSha: null,
28982900
});
28992901

2900-
expect(logger.debug).toHaveBeenCalledWith('Found existing branch PR');
2902+
expect(logger.debug).toHaveBeenCalledWith('Found existing branch PR #5');
29012903
expect(logger.debug).not.toHaveBeenCalledWith(
29022904
'No package files need updating',
29032905
);

lib/workers/repository/update/branch/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export async function processBranch(
193193
} else if (!branchPr && existingPr && !dependencyDashboardCheck) {
194194
logger.debug(
195195
{ prTitle: config.prTitle },
196-
'Closed PR already exists. Skipping branch.',
196+
`Closed PR #${existingPr.number} already exists. Skipping branch.`,
197197
);
198198
await handleClosedPr(config, existingPr);
199199
return {
@@ -302,7 +302,7 @@ export async function processBranch(
302302
config.baseBranch,
303303
);
304304
if (branchPr) {
305-
logger.debug('Found existing branch PR');
305+
logger.debug(`Found existing branch PR #${branchPr.number}`);
306306
if (branchPr.state !== 'open') {
307307
logger.debug(
308308
'PR has been closed or merged since this run started - aborting',

0 commit comments

Comments
 (0)