From a42069da44a9469b28bc05f4e6de600745697eb3 Mon Sep 17 00:00:00 2001 From: RahulGautamSingh Date: Sun, 29 Dec 2024 12:28:30 +0530 Subject: [PATCH] fix(platform/github): use correct url to find pr when only using branch name (#33324) --- lib/modules/platform/github/index.spec.ts | 4 ++-- lib/modules/platform/github/index.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/modules/platform/github/index.spec.ts b/lib/modules/platform/github/index.spec.ts index e16f3db73b860f..eb133f6ecae99b 100644 --- a/lib/modules/platform/github/index.spec.ts +++ b/lib/modules/platform/github/index.spec.ts @@ -2568,7 +2568,7 @@ describe('modules/platform/github/index', () => { const scope = httpMock.scope(githubApiHost); initRepoMock(scope, 'some/repo'); scope - .get('/repos/some/repo/pulls?head=some/repo:branch&state=open') + .get('/repos/some/repo/pulls?head=some:branch&state=open') .reply(200, [ { number: 1, @@ -2598,7 +2598,7 @@ describe('modules/platform/github/index', () => { const scope = httpMock.scope(githubApiHost); initRepoMock(scope, 'some/repo'); scope - .get('/repos/some/repo/pulls?head=some/repo:branch&state=open') + .get('/repos/some/repo/pulls?head=some:branch&state=open') .reply(200, []); await github.initRepo({ repository: 'some/repo' }); const pr = await github.findPr({ diff --git a/lib/modules/platform/github/index.ts b/lib/modules/platform/github/index.ts index 1298d0f908f04c..93488565ba630a 100644 --- a/lib/modules/platform/github/index.ts +++ b/lib/modules/platform/github/index.ts @@ -855,9 +855,10 @@ export async function findPr({ if (includeOtherAuthors) { const repo = config.parentRepo ?? config.repository; + const org = repo?.split('/')[0]; // PR might have been created by anyone, so don't use the cached Renovate PR list const { body: prList } = await githubApi.getJson( - `repos/${repo}/pulls?head=${repo}:${branchName}&state=open`, + `repos/${repo}/pulls?head=${org}:${branchName}&state=open`, { cacheProvider: repoCacheProvider }, );