From 349e00ab8a0e4d555551c4d679ce42f46c9c52a0 Mon Sep 17 00:00:00 2001 From: Bram Kortooms Date: Sun, 1 Dec 2024 13:03:51 +0200 Subject: [PATCH 1/2] feat: add optional project-id input parameter PAP-1244 #code-review --- README.md | 6 ++++++ src/config.ts | 1 + src/index.ts | 3 +++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 78189cd..f0110e2 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,12 @@ _Example:_ `name: GitHub scan ${{ github.sha }}` _Example:_ `api_token: ${{ secrets.NEURALEGION_TOKEN }}` +### `project_id` + +Provide project-id if you want to run a scan for a specific project. If you don't provide project-id, scan will run under Default project. + +_Example:_ `project_id: gBAh2n9BD9ps7FVQXbLWXv` + ### `restart_scan` **Required** when restarting an existing scan by its ID. You can get the scan ID in the Scans section in [the Bright app](https://app.neuralegion.com/login). diff --git a/src/config.ts b/src/config.ts index e5b7f01..6de7586 100644 --- a/src/config.ts +++ b/src/config.ts @@ -19,6 +19,7 @@ export interface Config { module?: string; crawlerUrls?: string[]; fileId?: string; + projectId?: string; hostsFilter?: string[]; tests?: TestType[]; } diff --git a/src/index.ts b/src/index.ts index 3fd02f7..964f2d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,7 @@ const apiToken = core.getInput('api_token', { required: true }); const restartScanID = core.getInput('restart_scan'); const name = core.getInput('name'); const fileId = core.getInput('file_id'); +const projectId = core.getInput('project_id'); const crawlerUrls = getArray('crawler_urls'); const excludedParams = getArray('exclude_params'); const excludedEntryPoints = getArray('exclude_entry_points'); @@ -90,6 +91,7 @@ if (restartScanID) { if ( !( fileId || + projectId || crawlerUrls || discoveryTypesIn || module_in || @@ -116,6 +118,7 @@ if (restartScanID) { module, ...(crawlerUrls ? { crawlerUrls } : {}), ...(fileId ? { fileId } : {}), + ...(projectId ? { projectId } : {}), ...(uniqueTests?.length ? { tests: uniqueTests } : {}), ...(hostsFilter?.length ? { hostsFilter } : {}), ...(excludedEntryPoints?.length || excludedParams?.length From 663080ff1ba3f0ae267645fb2b92088fcc3671dc Mon Sep 17 00:00:00 2001 From: Bram Kortooms Date: Mon, 2 Dec 2024 10:49:59 +0200 Subject: [PATCH 2/2] feat: add project-id to workflow inputs --- action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/action.yml b/action.yml index 8b105aa..19050b9 100644 --- a/action.yml +++ b/action.yml @@ -13,6 +13,9 @@ inputs: hostname: description: 'Hostname. Default is app.neuralegion.com' required: false + project_id: + description: 'Project ID for Scan' + required: false file_id: description: 'HAR-file ID' required: false