Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add analyses field with comma-separated list of analysis kinds to s…
…tatus reports
  • Loading branch information
mbg committed Aug 21, 2025
commit c208f33c5508954a2c9f09d306b535ed25775fea
9 changes: 9 additions & 0 deletions lib/analyses.js

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

1 change: 1 addition & 0 deletions lib/analyses.js.map

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

13 changes: 13 additions & 0 deletions lib/status-report.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/status-report.js.map

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

4 changes: 4 additions & 0 deletions src/analyses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum AnalysisKind {
CodeScanning = "code-scanning",
CodeQuality = "code-quality",
}
19 changes: 18 additions & 1 deletion src/status-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {
getRequiredInput,
isSelfHostedRunner,
} from "./actions-util";
import { AnalysisKind } from "./analyses";
import { getAnalysisKey, getApiClient } from "./api-client";
import { type Config } from "./config-utils";
import { isCodeQualityEnabled, type Config } from "./config-utils";
import { DocUrl } from "./doc-url";
import { EnvVar } from "./environment";
import { getRef } from "./git-utils";
Expand Down Expand Up @@ -91,6 +92,8 @@ export interface StatusReportBase {
action_version: string;
/** The name of the Actions event that triggered the workflow. */
actions_event_name?: string;
/** Comma-separated list of the kinds of analyses we are performing. */
analyses?: string;
/** Analysis key, normally composed from the workflow path and job name. */
analysis_key: string;
/** Build mode, if specified. */
Expand Down Expand Up @@ -287,12 +290,26 @@ export async function createStatusReportBase(
const isSteadyStateDefaultSetupRun =
process.env["CODE_SCANNING_IS_STEADY_STATE_DEFAULT_SETUP"] === "true";

// We leave `analyses` empty if we don't have a `config`, so that we don't
// accidentally report only `code-scanning` when we can't tell whether `code-quality`
// is enabled or not.
const analyses: AnalysisKind[] = [];

if (config !== undefined) {
analyses.push(AnalysisKind.CodeScanning);

if (isCodeQualityEnabled(config)) {
analyses.push(AnalysisKind.CodeQuality);
}
}

const statusReport: StatusReportBase = {
action_name: actionName,
action_oid: "unknown", // TODO decide if it's possible to fill this in
action_ref: actionRef,
action_started_at: actionStartedAt.toISOString(),
action_version: getActionVersion(),
analyses: analyses.join(","),
analysis_key,
build_mode: config?.buildMode,
commit_oid: commitOid,
Expand Down