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

feat: submit graph toggler #221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async function run(): Promise<void> {
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')
Expand Down Expand Up @@ -62,10 +63,11 @@ async function run(): Promise<void> {
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,
},
Expand Down