Skip to content

Commit 464c3ea

Browse files
authored
Adding team and policy (#44)
* adding team and policy * building * Update action.yml * comments from scott * comments from scott
1 parent d61e2f7 commit 464c3ea

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 18.15.0

action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ inputs:
2929
Override the detected FOSSA project name. If running FOSSA analysis on a
3030
Pull Request, as a start you can use the contexts `github.ref` or `github.ref_name`.
3131
required: false
32+
team:
33+
description: >-
34+
Allows you to specify the team for your project. It uses the team name, just as `--team` in the CLI. This will only work when creating a project.
35+
required: false
36+
policy:
37+
description: >-
38+
Allows you to specify the policy for your project. It uses the policy name, just as `--policy` in the CLI. This will only work when creating a project.
3239
debug:
3340
description: >-
3441
Run all FOSSA commands in debug mode. Running `fossa analyze` in debug

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ export const TEST_DIFF_REV = getInput('test-diff-revision', {required: false});
1414
export const ENDPOINT = getInput('endpoint', getInputOptions());
1515
export const BRANCH = getInput('branch', getInputOptions());
1616
export const PROJECT = getInput('project', getInputOptions());
17+
export const TEAM = getInput('team', {required: false});
18+
export const POLICY = getInput('policy', {required: false});
1719
export const DEBUG = getBooleanInput('debug', {required: false});

src/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
ENDPOINT,
99
BRANCH,
1010
PROJECT,
11+
TEAM,
12+
POLICY,
1113
DEBUG,
1214
} from './config';
1315
import { fetchFossaCli } from './download-cli';
@@ -27,13 +29,23 @@ export async function analyze(): Promise<void> {
2729
'--project',
2830
PROJECT,
2931
];
32+
const getTeamArgs = (): string[] => !TEAM ? [] : [
33+
'--team',
34+
TEAM,
35+
];
36+
const getPolicyArgs = (): string[] => !POLICY ? [] : [
37+
'--policy',
38+
POLICY,
39+
];
3040

3141
const getArgs = (cmd: string) => [
3242
CONTAINER ? 'container' : null,
3343
cmd,
3444
...getEndpointArgs(),
3545
...getBranchArgs(),
3646
...getProjectArgs(),
47+
...getTeamArgs(),
48+
...getPolicyArgs(),
3749
DEBUG ? '--debug' : null,
3850
].filter(arg => arg);
3951

@@ -50,7 +62,7 @@ export async function analyze(): Promise<void> {
5062

5163
// Collect default options: Env and listeners
5264
const PATH = process.env.PATH || '';
53-
const defaultOptions = { env: { ...process.env, PATH, FOSSA_API_KEY}, listeners};
65+
const defaultOptions = { env: { ...process.env, PATH, FOSSA_API_KEY }, listeners };
5466

5567
if (!RUN_TESTS) {
5668
output = '';
@@ -62,7 +74,7 @@ export async function analyze(): Promise<void> {
6274
}
6375
} else if (RUN_TESTS) {
6476
output = '';
65-
let args = [...getArgs('test'), CONTAINER];
77+
const args = [...getArgs('test'), CONTAINER];
6678

6779
if (TEST_DIFF_REV && TEST_DIFF_REV !== '') {
6880
args.push('--diff', TEST_DIFF_REV);

0 commit comments

Comments
 (0)