Merge pull request #1368 from marcogario/marcogario/code_scanning_ref

Read CODE_SCANNING_REF env variable
This commit is contained in:
Andrew Eisenberg 2022-11-15 09:14:09 -08:00 committed by GitHub
commit 6a0f768e01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

5
lib/actions-util.js generated
View file

@ -432,7 +432,10 @@ async function getRef() {
if ((hasRefInput || hasShaInput) && !(hasRefInput && hasShaInput)) {
throw new Error("Both 'ref' and 'sha' are required if one of them is provided.");
}
const ref = refInput || (0, util_1.getRequiredEnvParam)("GITHUB_REF");
// Workaround for a limitation of Actions dynamic workflows not setting
// the GITHUB_REF in some cases
const maybeCSRef = process.env["CODE_SCANNING_REF"];
const ref = refInput || maybeCSRef || (0, util_1.getRequiredEnvParam)("GITHUB_REF");
const sha = shaInput || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
// If the ref is a user-provided input, we have to skip logic
// and assume that it is really where they want to upload the results.

File diff suppressed because one or more lines are too long

View file

@ -520,7 +520,11 @@ export async function getRef(): Promise<string> {
);
}
const ref = refInput || getRequiredEnvParam("GITHUB_REF");
// Workaround for a limitation of Actions dynamic workflows not setting
// the GITHUB_REF in some cases
const maybeCSRef = process.env["CODE_SCANNING_REF"];
const ref = refInput || maybeCSRef || getRequiredEnvParam("GITHUB_REF");
const sha = shaInput || getRequiredEnvParam("GITHUB_SHA");
// If the ref is a user-provided input, we have to skip logic