Skip to content

Commit

Permalink
Add skip-test input
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <[email protected]>
  • Loading branch information
smorimoto committed Oct 5, 2020
1 parent 28e4947 commit 3277647
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ jobs:
analysis.
- `github-token`: This input is used to get the latest release of `fossa-cli`
from GitHub API.
- `skip-test`: This input is used to specify whether to execute
[`fossa test`](https://github.com/fossas/fossa-cli/blob/master/docs/user-guide.md/#fossa-test).
This takes a long time, so it's set to `true` by default.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ inputs:
required: true
github-token:
required: true
skip-test:
default: true
runs:
using: node12
main: dist/index.js
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7277,14 +7277,17 @@ const exec = __toModule(require_exec());
const core = __toModule(require_core());
const FOSSA_API_KEY = core.getInput("fossa-api-key");
const GITHUB_TOKEN = core.getInput("github-token");
const SKIP_TEST = (core.getInput("skip-test") || "false").toUpperCase() === "TRUE";

// src/analyze.ts
async function analyze() {
const PATH = process.env.PATH ? process.env.PATH : "";
const options = {env: {PATH, FOSSA_API_KEY}};
await exec.exec("fossa", ["init"]);
await exec.exec("fossa", ["analyze"], options);
await exec.exec("fossa", ["test"], options);
if (!SKIP_TEST) {
await exec.exec("fossa", ["test"], options);
}
}

// src/download.ts
Expand Down
6 changes: 4 additions & 2 deletions src/analyze.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { exec } from "@actions/exec";

import { FOSSA_API_KEY } from "./constants";
import { FOSSA_API_KEY, SKIP_TEST } from "./constants";

export async function analyze(): Promise<void> {
const PATH = process.env.PATH ? process.env.PATH : "";
const options = { env: { PATH, FOSSA_API_KEY } };
await exec("fossa", ["init"]);
await exec("fossa", ["analyze"], options);
await exec("fossa", ["test"], options);
if (!SKIP_TEST) {
await exec("fossa", ["test"], options);
}
}
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ import * as core from "@actions/core";
export const FOSSA_API_KEY = core.getInput("fossa-api-key");

export const GITHUB_TOKEN = core.getInput("github-token");

export const SKIP_TEST =
(core.getInput("skip-test") || "false").toUpperCase() === "TRUE";

0 comments on commit 3277647

Please sign in to comment.