Skip to content

Commit d109dd5

Browse files
committed
Detect PR branches for Default Setup
1 parent 3e5446c commit d109dd5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/analyze.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,19 @@ function getPullRequestBranches(): PullRequestBranches | undefined {
270270
head: pullRequest.head.label,
271271
};
272272
}
273+
274+
// PR analysis under Default Setup does not have the pull_request context,
275+
// but it should set CODE_SCANNING_REF and CODE_SCANNING_BASE_BRANCH.
276+
const codeScanningRef = process.env.CODE_SCANNING_REF;
277+
const codeScanningBaseBranch = process.env.CODE_SCANNING_BASE_BRANCH;
278+
if (codeScanningRef && codeScanningBaseBranch) {
279+
return {
280+
base: codeScanningBaseBranch,
281+
// PR analysis under Default Setup analyzes the PR head commit instead of
282+
// the merge commit, so we can use the provided ref directly.
283+
head: codeScanningRef,
284+
};
285+
}
273286
return undefined;
274287
}
275288

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy