forked from mage-os/github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
40 lines (32 loc) · 1.22 KB
/
index.ts
File metadata and controls
40 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as core from '@actions/core';
import { validateKind } from './kind/validate-kinds';
import { getMatrixForKind } from './matrix/get-matrix-for-kind';
import { validateProject } from "./project/validate-projects";
import { buildServicesForEntry } from "./services/build-services";
export async function run(): Promise<void> {
try {
const kind = core.getInput("kind");
const customVersions = core.getInput("custom_versions");
const project = core.getInput("project");
const recent_time_frame = core.getInput("recent_time_frame");
const include_services = core.getInput("include_services") === "true";
validateProject(<any>project)
validateKind(<any>kind, customVersions ? customVersions.split(',') : undefined);
core.setOutput('matrix', getMatrixForKind(kind, project, customVersions, recent_time_frame));
let matrix = getMatrixForKind(kind, project, customVersions);
if (include_services) {
matrix = {
magento: matrix.magento,
include: matrix.include.map((entry) => ({
...entry,
services: buildServicesForEntry(entry)
}))
};
}
core.setOutput('matrix', matrix);
}
catch (error) {
core.setFailed(error.message);
}
}
run()