We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e5446c commit d109dd5Copy full SHA for d109dd5
src/analyze.ts
@@ -270,6 +270,19 @@ function getPullRequestBranches(): PullRequestBranches | undefined {
270
head: pullRequest.head.label,
271
};
272
}
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
+ }
286
return undefined;
287
288
0 commit comments