Allow `Partial<Config>` for `createStatusReportBase` by mbg · Pull Request #3188 · github/codeql-action · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/analyze-action.js

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

4 changes: 2 additions & 2 deletions lib/autobuild-action.js

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

4 changes: 2 additions & 2 deletions lib/init-action-post.js

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

4 changes: 2 additions & 2 deletions lib/init-action.js

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

4 changes: 2 additions & 2 deletions lib/resolve-environment-action.js

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

23 changes: 15 additions & 8 deletions lib/start-proxy-action.js

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

4 changes: 2 additions & 2 deletions lib/upload-sarif-action.js

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

18 changes: 15 additions & 3 deletions src/start-proxy-action.ts
4 changes: 2 additions & 2 deletions src/start-proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test("getCredentials filters by language when specified", async (t) => {
getRunnerLogger(true),
undefined,
toEncodedJSON(mixedCredentials),
"java",
KnownLanguage.java,
);
t.is(credentials.length, 1);
t.is(credentials[0].type, "maven_repository");
Expand All @@ -120,7 +120,7 @@ test("getCredentials returns all for a language when specified", async (t) => {
getRunnerLogger(true),
undefined,
toEncodedJSON(mixedCredentials),
"go",
KnownLanguage.go,
);
t.is(credentials.length, 2);

Expand Down
3 changes: 1 addition & 2 deletions src/start-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ export function getCredentials(
logger: Logger,
registrySecrets: string | undefined,
registriesCredentials: string | undefined,
languageString: string | undefined,
language: KnownLanguage | undefined,
): Credential[] {
const language = languageString ? parseLanguage(languageString) : undefined;
const registryTypeForLanguage = language
? LANGUAGE_TO_REGISTRY_TYPE[language]
: undefined;
Expand Down
43 changes: 43 additions & 0 deletions src/status-report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,49 @@ test("createStatusReportBase", async (t) => {
});
});

test("createStatusReportBase - empty configuration", async (t) => {
await withTmpDir(async (tmpDir: string) => {
setupEnvironmentAndStub(tmpDir);

const statusReport = await createStatusReportBase(
ActionName.StartProxy,
"success",
new Date("May 19, 2023 05:19:00"),
{},
{ numAvailableBytes: 100, numTotalBytes: 500 },
getRunnerLogger(false),
);

if (t.truthy(statusReport)) {
t.is(statusReport.action_name, ActionName.StartProxy);
t.is(statusReport.status, "success");
}
});
});

test("createStatusReportBase - partial configuration", async (t) => {
await withTmpDir(async (tmpDir: string) => {
setupEnvironmentAndStub(tmpDir);

const statusReport = await createStatusReportBase(
ActionName.StartProxy,
"success",
new Date("May 19, 2023 05:19:00"),
{
languages: ["go"],
},
{ numAvailableBytes: 100, numTotalBytes: 500 },
getRunnerLogger(false),
);

if (t.truthy(statusReport)) {
t.is(statusReport.action_name, ActionName.StartProxy);
t.is(statusReport.status, "success");
t.is(statusReport.languages, "go");
}
});
});

test("createStatusReportBase_firstParty", async (t) => {
await withTmpDir(async (tmpDir: string) => {
setupEnvironmentAndStub(tmpDir);
Expand Down
6 changes: 3 additions & 3 deletions src/status-report.ts
Loading