-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathaction.ts
More file actions
63 lines (53 loc) · 1.99 KB
/
Copy pathaction.ts
File metadata and controls
63 lines (53 loc) · 1.99 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as core from '@actions/core';
import * as client from '@microsoft/security-devops-actions-toolkit/msdo-client';
import * as common from '@microsoft/security-devops-actions-toolkit/msdo-common';
async function run() {
let args: string[] = ['run'];
let config: string = core.getInput('config');
if (!common.isNullOrWhiteSpace(config)) {
args.push('-c');
args.push(config);
}
let policy: string = core.getInput('policy');
if (common.isNullOrWhiteSpace(policy)) {
policy = "GitHub";
}
args.push('-p');
args.push(policy);
let categoriesString: string = core.getInput('categories');
if (!common.isNullOrWhiteSpace(categoriesString)) {
args.push('--categories');
let categories = categoriesString.split(',');
for (let i = 0; i < categories.length; i++) {
let category = categories[i];
if (!common.isNullOrWhiteSpace(category)) {
args.push(category.trim());
}
}
}
let languagesString: string = core.getInput('languages');
if (!common.isNullOrWhiteSpace(languagesString)) {
let languages = languagesString.split(',');
args.push('--languages');
for (let i = 0; i < languages.length; i++) {
let language = languages[i];
if (!common.isNullOrWhiteSpace(language)) {
args.push(language.trim());
}
}
}
let toolsString: string = core.getInput('tools');
if (!common.isNullOrWhiteSpace(toolsString)) {
let tools = toolsString.split(',');
args.push('--tool');
for (let i = 0; i < tools.length; i++) {
let tool = tools[i];
if (!common.isNullOrWhiteSpace(tool)) {
args.push(tool.trim());
}
}
}
args.push('--github');
await client.run(args, 'microsoft/security-devops-action');
}
run().catch((error) => core.setFailed(error));