-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathindex.js
42 lines (36 loc) · 1.49 KB
/
index.js
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
//
// entry point when called from a Workflow Action
//
const core = require('@actions/core');
const github = require('@actions/github');
const importFlaws = require('./importer').importFlaws;
try {
// get input params
const resultsFile = core.getInput('scan-results-json', {required: true} );
const token = core.getInput('github-token', {required: true} );
const waitTime = core.getInput('wait-time'); // default set in Action.yml
const source_base_path_1 = core.getInput('source-base-path_1');
const source_base_path_2 = core.getInput('source-base-path_2');
const source_base_path_3 = core.getInput('source-base-path_3');
const commit_hash = core.getInput('commit-hash');
// other params
const owner = github.context.repo.owner;
const repo = github.context.repo.repo;
// context {{ github.repository }} = 'owner/reponame'
//console.log(`Calling with: resultsFile: ${resultsFile}, token: ${token}, waitTime: ${waitTime}, owner: ${owner}, repo: ${repo}`)
// do the thing
importFlaws(
{resultsFile: resultsFile,
githubOwner: owner,
githubRepo: repo,
githubToken: token,
waitTime: waitTime,
source_base_path_1: source_base_path_1,
source_base_path_2: source_base_path_2,
source_base_path_3: source_base_path_3,
commit_hash: commit_hash}
)
.catch(error => {console.error(`Failure at ${error.stack}`)});
} catch (error) {
core.setFailed(error.stack);
}