Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding team and policy #44

Merged
merged 5 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.15.0
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ inputs:
Override the detected FOSSA project name. If running FOSSA analysis on a
Pull Request, as a start you can use the contexts `github.ref` or `github.ref_name`.
required: false
team:
description: >-
saramaebee marked this conversation as resolved.
Show resolved Hide resolved
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.
required: false
policy:
description: >-
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.
debug:
description: >-
Run all FOSSA commands in debug mode. Running `fossa analyze` in debug
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ export const TEST_DIFF_REV = getInput('test-diff-revision', {required: false});
export const ENDPOINT = getInput('endpoint', getInputOptions());
export const BRANCH = getInput('branch', getInputOptions());
export const PROJECT = getInput('project', getInputOptions());
export const TEAM = getInput('team', {required: false});
export const POLICY = getInput('policy', {required: false});
export const DEBUG = getBooleanInput('debug', {required: false});
16 changes: 14 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
ENDPOINT,
BRANCH,
PROJECT,
TEAM,
POLICY,
DEBUG,
} from './config';
import { fetchFossaCli } from './download-cli';
Expand All @@ -27,13 +29,23 @@ export async function analyze(): Promise<void> {
'--project',
PROJECT,
];
const getTeamArgs = (): string[] => !TEAM ? [] : [
'--team',
TEAM,
];
const getPolicyArgs = (): string[] => !POLICY ? [] : [
'--policy',
POLICY,
];

const getArgs = (cmd: string) => [
CONTAINER ? 'container' : null,
cmd,
...getEndpointArgs(),
...getBranchArgs(),
...getProjectArgs(),
...getTeamArgs(),
...getPolicyArgs(),
DEBUG ? '--debug' : null,
].filter(arg => arg);

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

// Collect default options: Env and listeners
const PATH = process.env.PATH || '';
const defaultOptions = { env: { ...process.env, PATH, FOSSA_API_KEY}, listeners};
const defaultOptions = { env: { ...process.env, PATH, FOSSA_API_KEY }, listeners };

if (!RUN_TESTS) {
output = '';
Expand All @@ -62,7 +74,7 @@ export async function analyze(): Promise<void> {
}
} else if (RUN_TESTS) {
output = '';
let args = [...getArgs('test'), CONTAINER];
const args = [...getArgs('test'), CONTAINER];

if (TEST_DIFF_REV && TEST_DIFF_REV !== '') {
args.push('--diff', TEST_DIFF_REV);
Expand Down
Loading