Skip to content

Commit 74c9991

Browse files
Merge pull request #34 from github/upload_ref
upload ref in status report
2 parents d7b9f5a + f49335f commit 74c9991

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

lib/upload-lib.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/upload-lib.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async function uploadFiles(sarifFiles: string[]): Promise<boolean> {
145145

146146
const commitOid = util.getRequiredEnvParam('GITHUB_SHA');
147147
const workflowRunIDStr = util.getRequiredEnvParam('GITHUB_RUN_ID');
148-
const ref = util.getRequiredEnvParam('GITHUB_REF'); // it's in the form "refs/heads/master"
148+
const ref = util.getRef();
149149
const analysisKey = await util.getAnalysisKey();
150150
const analysisName = util.getRequiredEnvParam('GITHUB_WORKFLOW');
151151
const startedAt = process.env[sharedEnv.CODEQL_ACTION_STARTED_AT];

src/util.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,22 @@ export async function getAnalysisKey(): Promise<string> {
200200
return analysisKey;
201201
}
202202

203+
/**
204+
* Get the ref currently being analyzed.
205+
*/
206+
export function getRef(): string {
207+
// it's in the form "refs/heads/master"
208+
return getRequiredEnvParam('GITHUB_REF');
209+
}
210+
203211
interface StatusReport {
204212
"workflow_run_id": number;
205213
"workflow_name": string;
206214
"job_name": string;
207215
"matrix_vars"?: string;
208216
"languages": string;
209217
"commit_oid": string;
218+
"ref": string;
210219
"action_name": string;
211220
"action_oid": string;
212221
"started_at": string;
@@ -232,6 +241,7 @@ async function createStatusReport(
232241
Promise<StatusReport> {
233242

234243
const commitOid = process.env['GITHUB_SHA'] || '';
244+
const ref = getRef();
235245
const workflowRunIDStr = process.env['GITHUB_RUN_ID'];
236246
let workflowRunID = -1;
237247
if (workflowRunIDStr) {
@@ -249,6 +259,7 @@ async function createStatusReport(
249259
job_name: jobName,
250260
languages: languages,
251261
commit_oid: commitOid,
262+
ref: ref,
252263
action_name: actionName,
253264
action_oid: "unknown", // TODO decide if it's possible to fill this in
254265
started_at: startedAt,

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