Skip to content
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
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,21 @@ See also [`config-gradle`](#config-gradle) input environment variables.
| `provenance` | Whether to generate provenance attestation for built artifacts | `false` |
| `provenance-artifact-paths` | Relative paths of artifacts for provenance attestation (glob pattern). See [Provenance Attestation](#provenance-attestation) | (optional) |
| `generate-summary` | Whether to generate a workflow summary after the build | `true` |
| `job-identifier` | Unique identifier for the problems-report artifact name. Set to a matrix dimension (e.g. `${{ matrix.module }}`) when using this action inside a reusable workflow invoked in a matrix. Auto-generated UUID when omitted. | (optional) |

> [!TIP]
> When using this action inside a reusable workflow that is itself called in a matrix, set
> `job-identifier` to a matrix dimension to produce readable artifact names:
>
> ```yaml
> - uses: SonarSource/ci-github-actions/build-gradle@v1
> with:
> job-identifier: ${{ matrix.module }}
> ```
>
> Without this, a UUID is generated automatically — artifact names will be unique but opaque.

<!-- -->

> [!TIP]
> When using `working-directory`, Java must be available at root due to a limitation
Expand Down Expand Up @@ -957,6 +972,19 @@ See also [`config-npm`](#config-npm) input environment variables.
| `provenance` | Whether to generate provenance attestation for built artifacts | `false` |
| `provenance-artifact-paths` | Relative paths of artifacts for provenance attestation (glob pattern). See [Provenance Attestation](#provenance-attestation) | (optional) |
| `generate-summary` | Whether to generate a workflow summary after the build | `true` |
| `job-identifier` | Unique identifier for the npm-logs artifact name. Set to a matrix dimension (e.g. `${{ matrix.module }}`) when using this action inside a reusable workflow invoked in a matrix. Auto-generated UUID when omitted. | (optional) |

> [!TIP]
> When using this action inside a reusable workflow that is itself called in a matrix, set
> `job-identifier` to a matrix dimension to produce readable artifact names:
>
> ```yaml
> - uses: SonarSource/ci-github-actions/build-npm@v1
> with:
> job-identifier: ${{ matrix.module }}
> ```
>
> Without this, a UUID is generated automatically — artifact names will be unique but opaque.

### Outputs

Expand Down
15 changes: 14 additions & 1 deletion build-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ inputs:
generate-summary:
description: Whether to generate a workflow summary after the build.
default: 'true'
job-identifier:
description: >-
Unique identifier appended to the artifact name (`problems-report-<job-identifier>`).
Set this to a matrix dimension value (e.g. the value of `matrix.module`) when calling this action
from a reusable workflow that is invoked in a matrix, to produce human-readable artifact
names. When omitted, a random value is generated to guarantee uniqueness.
default: ''

outputs:
project-version:
Expand Down Expand Up @@ -175,11 +182,17 @@ runs:
working-directory: ${{ inputs.working-directory }}
run: $ACTION_PATH_BUILD_GRADLE/build.sh

- name: Generate unique job ID
id: uid
if: always()
shell: bash
run: echo "value=$RANDOM$RANDOM" >> "$GITHUB_OUTPUT"

- name: Archive problems report
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: problems-report-${{ github.job }}${{ strategy.job-index }}
name: problems-report-${{ inputs.job-identifier != '' && inputs.job-identifier || steps.uid.outputs.value }}
path: build/reports/problems/problems-report.html
if-no-files-found: ignore

Expand Down
15 changes: 14 additions & 1 deletion build-npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ inputs:
generate-summary:
description: Whether to generate a workflow summary after the build.
default: 'true'
job-identifier:
description: >-
Unique identifier appended to the artifact name (`npm-logs-<job-identifier>`).
Set this to a matrix dimension value (e.g. the value of `matrix.module`) when calling this action
from a reusable workflow that is invoked in a matrix, to produce human-readable artifact
names. When omitted, a random value is generated to guarantee uniqueness.
default: ''

outputs:
BUILD_NUMBER:
Expand Down Expand Up @@ -173,11 +180,17 @@ runs:
working-directory: ${{ inputs.working-directory }}
run: $ACTION_PATH_BUILD_NPM/build.sh

- name: Generate unique job ID
id: uid
if: always()
shell: bash
run: echo "value=$RANDOM$RANDOM" >> "$GITHUB_OUTPUT"

- name: Archive logs
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: npm-logs-${{ github.job }}${{ strategy.job-index }}
name: npm-logs-${{ inputs.job-identifier != '' && inputs.job-identifier || steps.uid.outputs.value }}
path: ~/.npm/_logs/
if-no-files-found: ignore

Expand Down
Loading