Rename env var to DIAGNOSTICS_DIR

This commit is contained in:
Michael B. Gale
2026-10-21 15:15:17 +01:00
parent 4707994e6e
commit 67cd8c12d4
3 changed files with 8 additions and 8 deletions

View File

@@ -86,7 +86,7 @@ jobs:
- name: Check diagnostics appear on disk
env:
SARIF_PATH: '${{ runner.temp }}/codeql-action-temp-diagnostics/'
DIAGNOSTICS_DIR: '${{ runner.temp }}/codeql-action-temp-diagnostics/'
run: |
cd ../action
npx tsx ./pr-checks/diagnostics-without-db.ts

View File

@@ -38,7 +38,7 @@ steps:
- name: Check diagnostics appear on disk
env:
SARIF_PATH: "${{ runner.temp }}/codeql-action-temp-diagnostics/"
DIAGNOSTICS_DIR: "${{ runner.temp }}/codeql-action-temp-diagnostics/"
run: |
cd ../action
npx tsx ./pr-checks/diagnostics-without-db.ts

View File

@@ -6,20 +6,20 @@ import * as core from "@actions/core";
import type * as diagnostics from "../src/diagnostics";
const DIAGNOSTIC_ID = "codeql-action/forced-nightly-cli";
const sarifDirectory = process.env["SARIF_PATH"];
const diagnosticDirectory = process.env["DIAGNOSTICS_DIR"];
if (sarifDirectory === undefined) {
throw new Error("SARIF_PATH is undefined.");
if (diagnosticDirectory === undefined) {
throw new Error("DIAGNOSTICS_DIR is undefined.");
}
const paths = fs
.readdirSync(sarifDirectory, {
.readdirSync(diagnosticDirectory, {
recursive: true,
encoding: "utf-8",
})
.filter((p) => p.endsWith(".json"));
core.info(`Found ${paths.length} paths in '${sarifDirectory}'.`);
core.info(`Found ${paths.length} paths in '${diagnosticDirectory}'.`);
core.info(`Searching for a diagnostic with id '${DIAGNOSTIC_ID}'...`);
let found = false;
@@ -31,7 +31,7 @@ for (const diagnosticPath of paths) {
core.info(`Found ${diagnosticPath}.`);
const contents = JSON.parse(
fs.readFileSync(path.resolve(sarifDirectory, diagnosticPath), "utf-8"),
fs.readFileSync(path.resolve(diagnosticDirectory, diagnosticPath), "utf-8"),
) as diagnostics.DiagnosticMessage;
if (contents.source.id === DIAGNOSTIC_ID) {