Skip to content

Commit ebda17e

Browse files
committed
respond to review comments
1 parent cca1dde commit ebda17e

File tree

5 files changed

+45
-60
lines changed

5 files changed

+45
-60
lines changed

lib/environment.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/status-report.test.js

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

lib/status-report.test.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/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export enum EnvVar {
4242
HAS_WARNED_ABOUT_DISK_SPACE = "CODEQL_ACTION_HAS_WARNED_ABOUT_DISK_SPACE",
4343

4444
/** Whether the init action has been run. */
45-
INIT_ACTION_HAS_RUN = "CODEQL_INIT_ACTION_HAS_RUN",
45+
INIT_ACTION_HAS_RUN = "CODEQL_ACTION_INIT_HAS_RUN",
4646

4747
/** UUID representing the current job run. */
4848
JOB_RUN_UUID = "JOB_RUN_UUID",

src/status-report.test.ts

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,26 @@ import { withTmpDir } from "./util";
99

1010
setupTests(test);
1111

12+
function setupEnvironmentAndStub(tmpDir: string) {
13+
setupActionsVars(tmpDir, tmpDir);
14+
15+
process.env["CODEQL_ACTION_ANALYSIS_KEY"] = "analysis-key";
16+
process.env["GITHUB_REF"] = "refs/heads/main";
17+
process.env["GITHUB_REPOSITORY"] = "octocat/HelloWorld";
18+
process.env["GITHUB_RUN_ATTEMPT"] = "2";
19+
process.env["GITHUB_RUN_ID"] = "100";
20+
process.env["GITHUB_SHA"] = "a".repeat(40);
21+
process.env["ImageVersion"] = "2023.05.19.1";
22+
process.env["RUNNER_OS"] = "macOS";
23+
process.env["RUNNER_TEMP"] = tmpDir;
24+
25+
const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
26+
getRequiredInput.withArgs("matrix").resolves("input/matrix");
27+
}
28+
1229
test("createStatusReportBase", async (t) => {
1330
await withTmpDir(async (tmpDir: string) => {
14-
setupActionsVars(tmpDir, tmpDir);
15-
16-
process.env["CODEQL_ACTION_ANALYSIS_KEY"] = "analysis-key";
17-
process.env["GITHUB_REF"] = "refs/heads/main";
18-
process.env["GITHUB_REPOSITORY"] = "octocat/HelloWorld";
19-
process.env["GITHUB_RUN_ATTEMPT"] = "2";
20-
process.env["GITHUB_RUN_ID"] = "100";
21-
process.env["GITHUB_SHA"] = "a".repeat(40);
22-
process.env["ImageVersion"] = "2023.05.19.1";
23-
process.env["RUNNER_OS"] = "macOS";
24-
25-
const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
26-
getRequiredInput.withArgs("matrix").resolves("input/matrix");
31+
setupEnvironmentAndStub(tmpDir);
2732

2833
const statusReport = await createStatusReportBase(
2934
"init",
@@ -43,14 +48,14 @@ test("createStatusReportBase", async (t) => {
4348
);
4449
t.is(statusReport.analysis_key, "analysis-key");
4550
t.is(statusReport.cause, "failure cause");
46-
t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]);
51+
t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]!);
4752
t.is(statusReport.exception, "exception stack trace");
4853
t.is(statusReport.job_name, process.env["GITHUB_JOB"] || "");
4954
t.is(typeof statusReport.job_run_uuid, "string");
50-
t.is(statusReport.ref, process.env["GITHUB_REF"]);
55+
t.is(statusReport.ref, process.env["GITHUB_REF"]!);
5156
t.is(statusReport.runner_available_disk_space_bytes, 100);
5257
t.is(statusReport.runner_image_version, process.env["ImageVersion"]);
53-
t.is(statusReport.runner_os, process.env["RUNNER_OS"]);
58+
t.is(statusReport.runner_os, process.env["RUNNER_OS"]!);
5459
t.is(statusReport.started_at, process.env[EnvVar.WORKFLOW_STARTED_AT]!);
5560
t.is(statusReport.status, "failure");
5661
t.is(statusReport.workflow_name, process.env["GITHUB_WORKFLOW"] || "");
@@ -61,20 +66,7 @@ test("createStatusReportBase", async (t) => {
6166

6267
test("createStatusReportBase_firstParty", async (t) => {
6368
await withTmpDir(async (tmpDir: string) => {
64-
setupActionsVars(tmpDir, tmpDir);
65-
66-
process.env["CODEQL_ACTION_ANALYSIS_KEY"] = "analysis-key";
67-
process.env["GITHUB_REF"] = "refs/heads/main";
68-
process.env["GITHUB_REPOSITORY"] = "octocat/HelloWorld";
69-
process.env["GITHUB_RUN_ATTEMPT"] = "2";
70-
process.env["GITHUB_RUN_ID"] = "100";
71-
process.env["GITHUB_SHA"] = "a".repeat(40);
72-
process.env["ImageVersion"] = "2023.05.19.1";
73-
process.env["RUNNER_OS"] = "macOS";
74-
process.env["RUNNER_TEMP"] = tmpDir;
75-
76-
const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
77-
getRequiredInput.withArgs("matrix").resolves("input/matrix");
69+
setupEnvironmentAndStub(tmpDir);
7870

7971
t.is(
8072
(
@@ -104,7 +96,7 @@ test("createStatusReportBase_firstParty", async (t) => {
10496
true,
10597
);
10698

107-
process.env["CODEQL_INIT_ACTION_HAS_RUN"] = "foobar";
99+
process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "foobar";
108100
t.is(
109101
(
110102
await createStatusReportBase(
@@ -133,7 +125,7 @@ test("createStatusReportBase_firstParty", async (t) => {
133125
true,
134126
);
135127

136-
process.env["CODEQL_INIT_ACTION_HAS_RUN"] = "true";
128+
process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "true";
137129
t.is(
138130
(
139131
await createStatusReportBase(

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