Skip to content

Commit

Permalink
adding cmd for api-key usage (#18)
Browse files Browse the repository at this point in the history
Signed-off-by: Benji Visser <benji@093b.org>
  • Loading branch information
noqcks committed Dec 8, 2023
1 parent 2ea3567 commit d0d3a4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ The inputs `image`, `path`, and `sbom` are mutually exclusive to specify the sou
| `registry-username` | The registry username to use when authenticating to an external registry | |
| `registry-password` | The registry password to use when authenticating to an external registry | |
| `fail-build` | Fail the build if an end-of-life (EOL) software is found | `true` |
| `api-key` | The API key to use to send results to xeol.io | N/A |
| `output-format` | Set the output parameter after successful action execution. Valid choices are `json`, and `table`, where `table` output will print to the console instead of generating a file. | `table` |


Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ async function run() {
// a check must happen to ensure one is selected at least, and then return it
const source = sourceInput();
const failBuild = core.getInput("fail-build") || "true";
const apiKey = core.getInput("api-key") || "";
const outputFormat = core.getInput("output-format") || "table";
const out = await runScan({
source,
failBuild,
apiKey,
outputFormat,
});
Object.keys(out).map((key) => {
Expand All @@ -104,6 +106,7 @@ async function run() {
async function runScan({
source,
failBuild,
apiKey,
outputFormat,
}) {
const out = {};
Expand Down Expand Up @@ -164,6 +167,9 @@ async function runScan({
if (failBuild) {
cmdArgs.push("--fail-on-eol-found");
}
if (apiKey) {
cmdArgs.push("--api-key", apiKey);
}
cmdArgs.push(source);

// This /dev/null writable stream is required so the entire Xeol output
Expand Down

0 comments on commit d0d3a4c

Please sign in to comment.