@factorialco/gat 2.6.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +0 -0
- package/dist/job.d.ts +4 -4
- package/dist/workflow.d.ts +5 -3
- package/dist/workflow.js +1 -7
- package/dist/workflow.spec.js +1 -1
- package/package.json +11 -13
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/job.d.ts
CHANGED
|
@@ -20,11 +20,11 @@ export interface Service {
|
|
|
20
20
|
options?: string;
|
|
21
21
|
volumes?: string[];
|
|
22
22
|
}
|
|
23
|
-
export interface JobOptions<Step,
|
|
23
|
+
export interface JobOptions<Step, RunnerDefinition, Name> {
|
|
24
24
|
prettyName?: string;
|
|
25
25
|
permissions?: object;
|
|
26
26
|
ifExpression?: string;
|
|
27
|
-
runsOn?:
|
|
27
|
+
runsOn?: RunnerDefinition;
|
|
28
28
|
timeout?: number;
|
|
29
29
|
dependsOn?: Array<Name>;
|
|
30
30
|
services?: Record<string, Service>;
|
|
@@ -36,7 +36,7 @@ export interface JobOptions<Step, Runner, Name> {
|
|
|
36
36
|
workingDirectory?: string;
|
|
37
37
|
}
|
|
38
38
|
export type StringWithNoSpaces<T> = T extends `${string} ${string}` ? never : T extends ` ${string}` ? never : T extends `${string} ` ? never : T;
|
|
39
|
-
export interface Job<Step,
|
|
39
|
+
export interface Job<Step, RunnerDefinition, Name> {
|
|
40
40
|
name: string;
|
|
41
|
-
options: JobOptions<Step,
|
|
41
|
+
options: JobOptions<Step, RunnerDefinition, Name>;
|
|
42
42
|
}
|
package/dist/workflow.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ConcurrencyGroup, Job, JobOptions, StringWithNoSpaces } from "./job";
|
|
2
2
|
import type { Event, EventName, EventOptions } from "./event";
|
|
3
3
|
import { type Step } from "./step";
|
|
4
|
-
declare const DEFAULT_RUNNERS: string[];
|
|
5
4
|
interface DefaultOptions {
|
|
6
5
|
workingDirectory: string;
|
|
7
6
|
}
|
|
@@ -9,7 +8,11 @@ interface EnvVar {
|
|
|
9
8
|
name: string;
|
|
10
9
|
value: string;
|
|
11
10
|
}
|
|
12
|
-
export
|
|
11
|
+
export type RunnerDefinition = string | {
|
|
12
|
+
group: string;
|
|
13
|
+
labels?: string[];
|
|
14
|
+
} | ["self-hosted", string];
|
|
15
|
+
export declare class Workflow<JobStep extends Step = Step, Runner extends RunnerDefinition = RunnerDefinition, JobName = never> {
|
|
13
16
|
name: string;
|
|
14
17
|
events: Event[];
|
|
15
18
|
jobs: Array<Job<JobStep, Runner, JobName>>;
|
|
@@ -23,7 +26,6 @@ export declare class Workflow<JobStep extends Step = Step, Runner = typeof DEFAU
|
|
|
23
26
|
setEnv(name: string, value: string): this;
|
|
24
27
|
setConcurrencyGroup(concurrencyGroup: ConcurrencyGroup): this;
|
|
25
28
|
defaultRunner(): string;
|
|
26
|
-
private assignRunner;
|
|
27
29
|
compile(filepath?: string): Promise<string | void>;
|
|
28
30
|
}
|
|
29
31
|
export {};
|
package/dist/workflow.js
CHANGED
|
@@ -12,7 +12,6 @@ const util_1 = require("util");
|
|
|
12
12
|
const axios_1 = __importDefault(require("axios"));
|
|
13
13
|
const step_1 = require("./step");
|
|
14
14
|
const writeFilePromise = (0, util_1.promisify)(fs_1.default.writeFile);
|
|
15
|
-
const DEFAULT_RUNNERS = ["ubuntu-22.04"];
|
|
16
15
|
const chainAttackCache = {};
|
|
17
16
|
const supplyChainAttack = async (step, enabled = false) => {
|
|
18
17
|
if (!(0, step_1.isUseStep)(step))
|
|
@@ -68,11 +67,6 @@ class Workflow {
|
|
|
68
67
|
defaultRunner() {
|
|
69
68
|
return "ubuntu-22.04";
|
|
70
69
|
}
|
|
71
|
-
assignRunner(runsOn) {
|
|
72
|
-
const runnerName = runsOn ?? this.defaultRunner();
|
|
73
|
-
const isSelfHosted = !DEFAULT_RUNNERS.includes(runnerName);
|
|
74
|
-
return isSelfHosted ? ["self-hosted", runnerName] : runnerName;
|
|
75
|
-
}
|
|
76
70
|
async compile(filepath) {
|
|
77
71
|
const result = {
|
|
78
72
|
name: this.name,
|
|
@@ -102,7 +96,7 @@ class Workflow {
|
|
|
102
96
|
name: prettyName,
|
|
103
97
|
permissions,
|
|
104
98
|
if: ifExpression,
|
|
105
|
-
"runs-on": this.
|
|
99
|
+
"runs-on": runsOn ?? this.defaultRunner(),
|
|
106
100
|
"timeout-minutes": timeout ?? 15,
|
|
107
101
|
needs: dependsOn,
|
|
108
102
|
services,
|
package/dist/workflow.spec.js
CHANGED
|
@@ -147,7 +147,7 @@ const workflow_1 = require("./workflow");
|
|
|
147
147
|
(0, vitest_1.it)("allows custom types in a workflow", async () => {
|
|
148
148
|
const workflow = new workflow_1.Workflow("With custom types");
|
|
149
149
|
workflow.on("push").addJob("job1", {
|
|
150
|
-
runsOn: "standard-runner",
|
|
150
|
+
runsOn: ["self-hosted", "standard-runner"],
|
|
151
151
|
steps: [
|
|
152
152
|
{
|
|
153
153
|
run: "echo 'Do something'",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorialco/gat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Write your GitHub Actions workflows using TypeScript",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gat": "dist/cli.js"
|
|
@@ -11,16 +11,6 @@
|
|
|
11
11
|
"dist/**/*"
|
|
12
12
|
],
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc",
|
|
16
|
-
"prepare": "npm run build",
|
|
17
|
-
"prepublishOnly": "vitest run",
|
|
18
|
-
"test": "vitest",
|
|
19
|
-
"coverage": "vitest run --coverage",
|
|
20
|
-
"lint": "eslint src/**/*.ts",
|
|
21
|
-
"format": "prettier --write .",
|
|
22
|
-
"format:check": "prettier --check ."
|
|
23
|
-
},
|
|
24
14
|
"author": "David Morcillo <david.morcillo@factorial.co>",
|
|
25
15
|
"license": "ISC",
|
|
26
16
|
"devDependencies": {
|
|
@@ -49,5 +39,13 @@
|
|
|
49
39
|
"bugs": {
|
|
50
40
|
"url": "https://github.com/factorialco/gat/issues"
|
|
51
41
|
},
|
|
52
|
-
"homepage": "https://github.com/factorialco/gat#readme"
|
|
53
|
-
|
|
42
|
+
"homepage": "https://github.com/factorialco/gat#readme",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc",
|
|
45
|
+
"test": "vitest",
|
|
46
|
+
"coverage": "vitest run --coverage",
|
|
47
|
+
"lint": "eslint src/**/*.ts",
|
|
48
|
+
"format": "prettier --write .",
|
|
49
|
+
"format:check": "prettier --check ."
|
|
50
|
+
}
|
|
51
|
+
}
|