Skip to content

Commit 72bd9cb

Browse files
authored
Merge pull request #1321 from github/criemen/datadog-tag
Actions status report: Send testing_environment.
2 parents aa07b38 + 77b1f7e commit 72bd9cb

File tree

6 files changed

+31
-3
lines changed

6 files changed

+31
-3
lines changed

lib/actions-util.js

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

lib/actions-util.js.map

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/shared-environment.js

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

lib/shared-environment.js.map

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

src/actions-util.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,12 @@ export interface StatusReportBase {
600600
completed_at?: string;
601601
/** State this action is currently in. */
602602
status: ActionStatus;
603+
/**
604+
* Testing environment: Set if non-production environment.
605+
* The server accepts one of the following values:
606+
* `["", "qa-rc", "qa-rc-1", "qa-rc-2", "qa-experiment-1", "qa-experiment-2", "qa-experiment-3"]`.
607+
*/
608+
testing_environment: string;
603609
/**
604610
* Information about the enablement of the ML-powered JS query pack.
605611
*
@@ -675,6 +681,16 @@ export async function createStatusReportBase(
675681
const runnerOs = getRequiredEnvParam("RUNNER_OS");
676682
const codeQlCliVersion = getCachedCodeQlVersion();
677683
const actionRef = process.env["GITHUB_ACTION_REF"];
684+
const testingEnvironment =
685+
process.env[sharedEnv.CODEQL_ACTION_TESTING_ENVIRONMENT] || "";
686+
// re-export the testing environment variable so that it is available to subsequent steps,
687+
// even if it was only set for this step
688+
if (testingEnvironment !== "") {
689+
core.exportVariable(
690+
sharedEnv.CODEQL_ACTION_TESTING_ENVIRONMENT,
691+
testingEnvironment
692+
);
693+
}
678694

679695
const statusReport: StatusReportBase = {
680696
workflow_run_id: workflowRunID,
@@ -689,6 +705,7 @@ export async function createStatusReportBase(
689705
started_at: workflowStartedAt,
690706
action_started_at: actionStartedAt.toISOString(),
691707
status,
708+
testing_environment: testingEnvironment,
692709
runner_os: runnerOs,
693710
action_version: pkg.version,
694711
};

src/shared-environment.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ export const ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION";
55
// then this variable will be assigned the start time of the action invoked
66
// rather that the init action.
77
export const CODEQL_WORKFLOW_STARTED_AT = "CODEQL_WORKFLOW_STARTED_AT";
8+
9+
export const CODEQL_ACTION_TESTING_ENVIRONMENT =
10+
"CODEQL_ACTION_TESTING_ENVIRONMENT";

0 commit comments

Comments
 (0)