Skip to content

Commit 44f4cc7

Browse files
authored
fix(pr): resolve target commit from merge (#1)
Azure Pipelines doesn't like git operations that reference branches by default (probably because they're not available in the cloned repo). Switch to pulling the commit hash from the merge commit parent instead because that doesn't require branch references.
1 parent a3d680f commit 44f4cc7

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/index.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ async function lastPrCommit(): Promise<string> {
3535
}
3636

3737
async function lastTargetCommit(): Promise<string> {
38-
const { stdout } = await execa('git', [
39-
'log',
40-
'-n',
41-
'1',
42-
'--pretty=format:%H',
43-
process.env.SYSTEM_PULLREQUEST_TARGETBRANCH!
44-
]);
38+
const { stdout } = await execa('git', ['rev-parse', 'HEAD^1']);
4539
return stdout;
4640
}
4741

0 commit comments

Comments
 (0)