Skip to content

Commit

Permalink
Merge pull request #1321 from github/criemen/datadog-tag
Browse files Browse the repository at this point in the history
Actions status report: Send testing_environment.
  • Loading branch information
criemen committed Nov 1, 2022
2 parents aa07b38 + 77b1f7e commit 72bd9cb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
7 changes: 7 additions & 0 deletions lib/actions-util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/shared-environment.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/shared-environment.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/actions-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,12 @@ export interface StatusReportBase {
completed_at?: string;
/** State this action is currently in. */
status: ActionStatus;
/**
* Testing environment: Set if non-production environment.
* The server accepts one of the following values:
* `["", "qa-rc", "qa-rc-1", "qa-rc-2", "qa-experiment-1", "qa-experiment-2", "qa-experiment-3"]`.
*/
testing_environment: string;
/**
* Information about the enablement of the ML-powered JS query pack.
*
Expand Down Expand Up @@ -675,6 +681,16 @@ export async function createStatusReportBase(
const runnerOs = getRequiredEnvParam("RUNNER_OS");
const codeQlCliVersion = getCachedCodeQlVersion();
const actionRef = process.env["GITHUB_ACTION_REF"];
const testingEnvironment =
process.env[sharedEnv.CODEQL_ACTION_TESTING_ENVIRONMENT] || "";
// re-export the testing environment variable so that it is available to subsequent steps,
// even if it was only set for this step
if (testingEnvironment !== "") {
core.exportVariable(
sharedEnv.CODEQL_ACTION_TESTING_ENVIRONMENT,
testingEnvironment
);
}

const statusReport: StatusReportBase = {
workflow_run_id: workflowRunID,
Expand All @@ -689,6 +705,7 @@ export async function createStatusReportBase(
started_at: workflowStartedAt,
action_started_at: actionStartedAt.toISOString(),
status,
testing_environment: testingEnvironment,
runner_os: runnerOs,
action_version: pkg.version,
};
Expand Down
3 changes: 3 additions & 0 deletions src/shared-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ export const ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION";
// then this variable will be assigned the start time of the action invoked
// rather that the init action.
export const CODEQL_WORKFLOW_STARTED_AT = "CODEQL_WORKFLOW_STARTED_AT";

export const CODEQL_ACTION_TESTING_ENVIRONMENT =
"CODEQL_ACTION_TESTING_ENVIRONMENT";

0 comments on commit 72bd9cb

Please sign in to comment.