Skip to content

Commit 2f77cd0

Browse files
committed
Add specification types
1 parent c7e378f commit 2f77cd0

1 file changed

Lines changed: 53 additions & 3 deletions

File tree

pr-checks/sync.ts

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,66 @@ import * as path from "path";
55

66
import * as yaml from "js-yaml";
77

8+
/**
9+
* Represents workflow input definitions.
10+
*/
11+
interface WorkflowInput {
12+
type: string;
13+
description: string;
14+
required: boolean;
15+
default: string;
16+
}
17+
18+
/**
19+
* Represents PR check specifications.
20+
*/
21+
interface Specification {
22+
/** The display name for the check. */
23+
name: string;
24+
/** The workflow steps specific to this check. */
25+
steps: any[];
26+
/** Workflow-level input definitions forwarded to `workflow_dispatch`/`workflow_call`. */
27+
inputs?: Record<string, WorkflowInput>;
28+
/** CodeQL bundle versions to test against. Defaults to `DEFAULT_TEST_VERSIONS`. */
29+
versions?: string[];
30+
/** Operating system prefixes used to select runner images (e.g. `["ubuntu", "macos"]`). */
31+
operatingSystems?: string[];
32+
/** Whether to use the all-platform CodeQL bundle. */
33+
useAllPlatformBundle?: string;
34+
/** Values for the `analysis-kinds` matrix dimension. */
35+
analysisKinds?: string[];
36+
37+
installNode?: string | boolean;
38+
installGo?: string | boolean;
39+
installJava?: string | boolean;
40+
installPython?: string | boolean;
41+
installDotNet?: string | boolean;
42+
installYq?: string | boolean;
43+
44+
/** Container image configuration for the job. */
45+
container?: any;
46+
/** Service containers for the job. */
47+
services?: any;
48+
49+
/** Custom permissions override for the job. */
50+
permissions?: Record<string, string>;
51+
/** Extra environment variables for the job. */
52+
env?: Record<string, any>;
53+
54+
/** If set, this check is part of a named collection that gets its own caller workflow. */
55+
collection?: string;
56+
}
57+
858
const THIS_DIR = __dirname;
959
const CHECKS_DIR = path.join(THIS_DIR, "checks");
1060
const OUTPUT_DIR = path.join(THIS_DIR, "new-output");
1161

1262
/**
13-
* Load and parse a YAML file, returning its contents as an object.
63+
* Loads and parses a YAML file as a `Specification`.
1464
*/
15-
function loadYaml(filePath: string): any {
65+
function loadYaml(filePath: string): Specification {
1666
const content = fs.readFileSync(filePath, "utf8");
17-
return yaml.load(content);
67+
return yaml.load(content) as Specification;
1868
}
1969

2070
/**

0 commit comments

Comments
 (0)