diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index 9cf294746a4a648ecfb35f0458ef2777b5b3b78a..3b86b2f6ece9ce8897fb9b31dc2d69c723b6cc75 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -280,7 +280,9 @@ export async function findPr( try { const prs = await getPrList(); - prsFiltered = prs.filter(item => item.head.ref === branchName); + prsFiltered = prs.filter( + item => item.sourceRefName === azureHelper.getNewBranchName(branchName) + ); if (prTitle) { prsFiltered = prsFiltered.filter(item => item.title === prTitle); diff --git a/test/platform/azure/__snapshots__/index.spec.ts.snap b/test/platform/azure/__snapshots__/index.spec.ts.snap index 3b810b7a1a7cce63da988669acaefecf87dbea3d..16ce1928c6e10a323974016f9c0d465f9ab83564 100644 --- a/test/platform/azure/__snapshots__/index.spec.ts.snap +++ b/test/platform/azure/__snapshots__/index.spec.ts.snap @@ -52,10 +52,8 @@ Array [ exports[`platform/azure findPr(branchName, prTitle, state) returns pr if found it all state 1`] = ` Object { - "head": Object { - "ref": "branch-a", - }, "number": 1, + "sourceRefName": "refs/heads/branch-a", "state": "closed", "title": "branch a pr", } @@ -63,10 +61,8 @@ Object { exports[`platform/azure findPr(branchName, prTitle, state) returns pr if found it close 1`] = ` Object { - "head": Object { - "ref": "branch-a", - }, "number": 1, + "sourceRefName": "refs/heads/branch-a", "state": "closed", "title": "branch a pr", } @@ -74,10 +70,8 @@ Object { exports[`platform/azure findPr(branchName, prTitle, state) returns pr if found it open 1`] = ` Object { - "head": Object { - "ref": "branch-a", - }, "number": 1, + "sourceRefName": "refs/heads/branch-a", "state": "open", "title": "branch a pr", } @@ -85,10 +79,8 @@ Object { exports[`platform/azure findPr(branchName, prTitle, state) returns pr if found not open 1`] = ` Object { - "head": Object { - "ref": "branch-a", - }, "number": 1, + "sourceRefName": "refs/heads/branch-a", "state": "closed", "title": "branch a pr", } diff --git a/test/platform/azure/index.spec.ts b/test/platform/azure/index.spec.ts index 24744f5a7de7c005614a1adeb42cb70b9df3e3ee..06c54a7d32ada17b0feaee4848e69e0b271c5b9d 100644 --- a/test/platform/azure/index.spec.ts +++ b/test/platform/azure/index.spec.ts @@ -222,7 +222,7 @@ describe('platform/azure', () => { () => ({ number: 1, - head: { ref: 'branch-a' }, + sourceRefName: 'refs/heads/branch-a', title: 'branch a pr', state: 'open', } as any) @@ -254,7 +254,7 @@ describe('platform/azure', () => { () => ({ number: 1, - head: { ref: 'branch-a' }, + sourceRefName: 'refs/heads/branch-a', title: 'branch a pr', state: 'closed', } as any) @@ -286,7 +286,7 @@ describe('platform/azure', () => { () => ({ number: 1, - head: { ref: 'branch-a' }, + sourceRefName: 'refs/heads/branch-a', title: 'branch a pr', state: 'closed', } as any) @@ -318,7 +318,7 @@ describe('platform/azure', () => { () => ({ number: 1, - head: { ref: 'branch-a' }, + sourceRefName: 'refs/heads/branch-a', title: 'branch a pr', state: 'closed', } as any)