Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Add an input for configuring correlator. #206

Merged
merged 1 commit into from
Feb 7, 2023
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ The following example showcases a gradle module in the root, without a module na
| `gradle-dependency-path` | Defines the path to the gradle dependency file, relative to the `gradle-project-path`. If not provided, automatically resolved via gradle and the `module` config. |
| `sub-module-mode` | Defines how the action handles sub projects/modules. Possible options `IGNORE`, `COMBINED`, `INDIVIDUAL`, `INDIVIDUAL_DEEP`. Default: `IGNORE`. |
| `include-build-environment` | Optional mode to enable the submission of the `buildEnvironment` as individual Manifest via the dependency submission API. Default: `false`. |
| `correlator` | 'Optional correlator string to submit to GitHub to identify the dependency submission. Defaults to generating based on gradle-build-module and gradle-build-configuration.' |

| **sub-module-mode** | **Description** |
| ----- | ---- |
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ inputs:
required: false
description: 'Optional mode to also submit the `buildEnvironment` to the dependency submission API. This will execute the `buildEnvironment` task on the root module.'
default: 'false'
correlator:
required: false
description: 'Optional correlator string to submit to GitHub to identify the dependency submission. Defaults to generating based on gradle-build-module and gradle-build-configuration.'
default: ''
runs:
using: 'node16'
main: 'dist/index.js'
6 changes: 5 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ async function run(): Promise<void> {
let subModuleMode: 'INDIVIDUAL' | 'INDIVIDUAL_DEEP' | 'COMBINED' | 'IGNORE'
const subModuleModeInput = core.getInput('sub-module-mode')
const includeBuildEnvironment = core.getBooleanInput('include-build-environment')
let correlator = core.getInput('correlator')

// verify inputs are valid
if (gradleProjectPath.length === 0) {
Expand Down Expand Up @@ -66,6 +67,10 @@ async function run(): Promise<void> {
core.debug(` will use build configuration ${configuration} for ${module}`)
}

if (correlator === '') {
correlator = `${github.context.job}-${gradleBuildModule.join('_')}-${gradleBuildConfiguration.join('_')}`
}

core.endGroup()

const manifests: Manifest[] = []
Expand Down Expand Up @@ -101,7 +106,7 @@ async function run(): Promise<void> {
},
github.context,
{
correlator: `${github.context.job}-${gradleBuildModule.join('_')}-${gradleBuildConfiguration.join('_')}`,
correlator,
id: github.context.runId.toString()
}
)
Expand Down
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function parseGradleDependency(
}

const parent = parseGradlePackage(line, level)
if(parent) {
if (parent) {
if (parentParent) {
project.packages.push([parentParent, parent])
}
Expand Down