From ddab4ef157945ed44b86724bd4059eb329db7577 Mon Sep 17 00:00:00 2001 From: Andrii Yakovenko Date: Thu, 17 Oct 2024 21:42:58 +0300 Subject: [PATCH] feat: submit graph toggler --- README.md | 5 +++++ action.yml | 4 ++++ src/main.ts | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e2cf76..312724f 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,11 @@ GitHub Personal Access Token (PAT). Defaults to PAT provided by Action runner. Example: `${{ secrets.USER_TOKEN }}` +#### - `submit-graph` (optional) + +Submit graph to the Github submission API or only generate the dependency graph +Defaults: yes + ### Outputs #### `submission-id` diff --git a/action.yml b/action.yml index d5e20aa..4b290e4 100644 --- a/action.yml +++ b/action.yml @@ -43,6 +43,10 @@ inputs: description: Version of the sbt plugin to use. required: false default: '3.1.0' + submit-graph: + description: Submit dependency graph or no + required: false + default: 'yes' outputs: submission-id: description: The ID of the submission created by the action diff --git a/src/main.ts b/src/main.ts index 235e07b..cf3b4f7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,6 +13,7 @@ async function run(): Promise { const token = core.getInput('token') core.setSecret(token) + const submitGraph = core.getInput('submit-graph') === 'yes' ? true : false const workingDirInput = core.getInput('working-directory') const workingDir = workingDirInput.length === 0 ? '.' : workingDirInput const projectDir = path.join(workingDir, 'project') @@ -62,10 +63,11 @@ async function run(): Promise { process.env['GITHUB_SHA'] = payload.pull_request.head.sha } + const submitGraphArgument = submitGraph ? 'githubSubmitSnapshot' : '' process.env['GITHUB_TOKEN'] = token await cli.exec( 'sbt', - ['--batch', `githubGenerateSnapshot ${JSON.stringify(input)}; githubSubmitSnapshot`], + ['--batch', `githubGenerateSnapshot ${JSON.stringify(input)}; ${submitGraphArgument}`], { cwd: workingDir, },