Skip to content

Commit 06c24e8

Browse files
BUILD-8677 Add job name to summaries and fix consistency
- Add `$GITHUB_JOB` to the ## heading in all build and promote summaries so jobs sharing the same action are distinguishable - Add missing `generate-summary` input to build-gradle, build-npm, build-poetry, build-yarn (was already present in build-maven). Generalize #222 - Fix bug: build-npm/poetry/yarn summary checked non-existent output `should-deploy`; corrected to `deployed`. Fix #136 - Fix build-yarn: missing blank lines before outputs: and summary step Update README for workflow summary changes - Document `generate-summary` input in build-maven, build-gradle, build-npm, build-poetry, and build-yarn Inputs tables - Add "GitHub workflow job summary" entry to Features sections for build-maven, build-gradle, build-npm, build-yarn, and promote Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c046c0f commit 06c24e8

8 files changed

Lines changed: 42 additions & 14 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ See also [`config-maven`](#config-maven) input environment variables.
332332
| `provenance` | Whether to generate provenance attestation for built artifacts | `false` |
333333
| `provenance-artifact-paths` | Relative paths of artifacts for provenance attestation (glob pattern). See [Provenance Attestation](#provenance-attestation) | (optional) |
334334
| `mixed-privacy` | Whether the repository contains both public and private code | `false` |
335+
| `generate-summary` | Whether to generate a workflow summary after the build | `true` |
335336

336337
#### `cache-cleanup`
337338

@@ -387,6 +388,7 @@ See also [`config-maven`](#config-maven) output environment variables.
387388
- **feature** (`feature/long/*`): Verify + SonarQube analysis only
388389
- **default**: Basic verify goal only
389390
- Mixed privacy repository support for combined public and private artifacts
391+
- GitHub workflow job summary with build information and deployment status
390392

391393
## `build-poetry`
392394

@@ -474,6 +476,7 @@ jobs:
474476
| `disable-caching` | Whether to disable Poetry caching entirely | `false` |
475477
| `provenance` | Whether to generate provenance attestation for built artifacts | `false` |
476478
| `provenance-artifact-paths` | Relative paths of artifacts for provenance attestation (glob pattern). See [Provenance Attestation](#provenance-attestation) | (optional) |
479+
| `generate-summary` | Whether to generate a workflow summary after the build | `true` |
477480

478481
### Outputs
479482

@@ -711,6 +714,7 @@ See also [`config-gradle`](#config-gradle) input environment variables.
711714
| `disable-caching` | Whether to disable Gradle caching entirely | `false` |
712715
| `provenance` | Whether to generate provenance attestation for built artifacts | `false` |
713716
| `provenance-artifact-paths` | Relative paths of artifacts for provenance attestation (glob pattern). See [Provenance Attestation](#provenance-attestation) | (optional) |
717+
| `generate-summary` | Whether to generate a workflow summary after the build | `true` |
714718

715719
> [!TIP]
716720
> When using `working-directory`, Java must be available at root due to a limitation
@@ -750,6 +754,7 @@ See also [`config-gradle`](#config-gradle) input environment variables.
750754
- Develocity integration for build scans
751755
- Gradle caching with customization options
752756
- Comprehensive build logging and error handling
757+
- GitHub workflow job summary with build information and deployment status
753758

754759
### Caching Configuration
755760

@@ -999,6 +1004,7 @@ See also [`config-npm`](#config-npm) input environment variables.
9991004
| `build-name` | Name of the JFrog build to publish. | `<Repository name>` |
10001005
| `provenance` | Whether to generate provenance attestation for built artifacts | `false` |
10011006
| `provenance-artifact-paths` | Relative paths of artifacts for provenance attestation (glob pattern). See [Provenance Attestation](#provenance-attestation) | (optional) |
1007+
| `generate-summary` | Whether to generate a workflow summary after the build | `true` |
10021008

10031009
### Outputs
10041010

@@ -1029,6 +1035,7 @@ See also [`config-npm`](#config-npm) output environment variables.
10291035
- JFrog build info publishing with UI links
10301036
- Support for different branch types (default, maintenance, PR, dogfood, long-lived feature)
10311037
- Comprehensive build logging and error handling
1038+
- GitHub workflow job summary with build information and deployment status
10321039

10331040
## `build-yarn`
10341041

@@ -1108,6 +1115,7 @@ jobs:
11081115
| `run-shadow-scans` | Enable analysis across all 3 SonarQube platforms (unified platform dogfooding) | `false` |
11091116
| `provenance` | Whether to generate provenance attestation for built artifacts | `false` |
11101117
| `provenance-artifact-paths` | Relative paths of artifacts for provenance attestation (glob pattern). See [Provenance Attestation](#provenance-attestation) | (optional) |
1118+
| `generate-summary` | Whether to generate a workflow summary after the build | `true` |
11111119

11121120
### Outputs
11131121

@@ -1129,6 +1137,7 @@ jobs:
11291137
- JFrog build info publishing with UI links
11301138
- Support for different branch types (default, maintenance, PR, dogfood, long-lived feature)
11311139
- Comprehensive build logging and error handling
1140+
- GitHub workflow job summary with build information and deployment status
11321141

11331142
## `config-pip`
11341143

@@ -1318,6 +1327,7 @@ This action does not provide any outputs.
13181327
- Support for both single and multi-repository promotions
13191328
- Automatic target repository determination based on branch type
13201329
- Pull request artifact promotion support
1330+
- GitHub workflow job summary with promotion information and deployment link
13211331

13221332
---
13231333

build-gradle/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ inputs:
6464
disable-caching:
6565
description: Whether to disable Gradle caching entirely
6666
default: 'false'
67+
generate-summary:
68+
description: Whether to generate a workflow summary after the build.
69+
default: 'true'
6770

6871
outputs:
6972
project-version:
@@ -192,11 +195,11 @@ runs:
192195
show-summary: true
193196

194197
- name: Generate workflow summary
195-
if: always()
198+
if: always() && inputs.generate-summary != 'false'
196199
shell: bash
197200
run: |
198201
build_name="${GITHUB_REPOSITORY#*/}"
199-
echo "## 🏗️ Gradle Build Summary" >> $GITHUB_STEP_SUMMARY
202+
echo "## 🏗️ Gradle Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
200203
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
201204
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
202205
else

build-maven/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ runs:
237237
shell: bash
238238
run: |
239239
build_name="${GITHUB_REPOSITORY#*/}"
240-
echo "## 🏗️ Maven Build Summary" >> $GITHUB_STEP_SUMMARY
240+
echo "## 🏗️ Maven Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
241241
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
242242
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
243243
else

build-npm/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ inputs:
5050
Relative paths of the artifacts for which to generate a provenance attestation (glob pattern).
5151
Default is collected from '.attestation-artifacts/' directory
5252
default: ''
53+
generate-summary:
54+
description: Whether to generate a workflow summary after the build.
55+
default: 'true'
5356

5457
outputs:
5558
BUILD_NUMBER:
@@ -177,14 +180,14 @@ runs:
177180
show-summary: true
178181

179182
- name: Generate workflow summary
180-
if: always()
183+
if: always() && inputs.generate-summary != 'false'
181184
shell: bash
182185
env:
183186
ARTIFACTORY_URL: ${{ inputs.repox-artifactory-url != '' && inputs.repox-artifactory-url ||
184187
format('{0}/artifactory', inputs.repox-url) }}
185188
run: |
186189
build_name="${GITHUB_REPOSITORY#*/}"
187-
echo "## 📦 NPM Build Summary" >> $GITHUB_STEP_SUMMARY
190+
echo "## 📦 NPM Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
188191
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
189192
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
190193
else
@@ -197,7 +200,7 @@ runs:
197200
echo "- **Branch**: \`${GITHUB_REF}\`" >> $GITHUB_STEP_SUMMARY
198201
echo "- **Commit**: \`$GITHUB_SHA\`" >> $GITHUB_STEP_SUMMARY
199202
200-
if [[ "${{ steps.build.outputs.should-deploy }}" == true ]]; then
203+
if [[ "${{ steps.build.outputs.deployed }}" == true ]]; then
201204
echo "### 🚀 Deployment" >> $GITHUB_STEP_SUMMARY
202205
ARTIFACTORY_BROWSE_URL="${ARTIFACTORY_URL%/*}/ui/builds/$build_name/$BUILD_NUMBER"
203206
echo "🔗 **[Browse artifacts in Artifactory](${ARTIFACTORY_BROWSE_URL})**" >> $GITHUB_STEP_SUMMARY

build-poetry/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ inputs:
5454
disable-caching:
5555
description: Whether to disable Poetry caching entirely
5656
default: 'false'
57+
generate-summary:
58+
description: Whether to generate a workflow summary after the build.
59+
default: 'true'
5760

5861
outputs:
5962
project-version:
@@ -174,14 +177,14 @@ runs:
174177
show-summary: true
175178

176179
- name: Generate workflow summary
177-
if: always()
180+
if: always() && inputs.generate-summary != 'false'
178181
shell: bash
179182
env:
180183
ARTIFACTORY_URL: ${{ inputs.repox-artifactory-url != '' && inputs.repox-artifactory-url ||
181184
format('{0}/artifactory', inputs.repox-url) }}
182185
run: |
183186
build_name="${GITHUB_REPOSITORY#*/}"
184-
echo "## 📦 Poetry Build Summary" >> $GITHUB_STEP_SUMMARY
187+
echo "## 📦 Poetry Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
185188
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
186189
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
187190
else
@@ -194,7 +197,7 @@ runs:
194197
echo "- **Branch**: \`${GITHUB_REF}\`" >> $GITHUB_STEP_SUMMARY
195198
echo "- **Commit**: \`$GITHUB_SHA\`" >> $GITHUB_STEP_SUMMARY
196199
197-
if [[ "${{ steps.build.outputs.should-deploy }}" == true ]]; then
200+
if [[ "${{ steps.build.outputs.deployed }}" == true ]]; then
198201
echo "### 🚀 Deployment" >> $GITHUB_STEP_SUMMARY
199202
ARTIFACTORY_BROWSE_URL="${ARTIFACTORY_URL%/*}/ui/builds/$build_name/$BUILD_NUMBER"
200203
echo "🔗 **[Browse artifacts in Artifactory](${ARTIFACTORY_BROWSE_URL})**" >> $GITHUB_STEP_SUMMARY

build-yarn/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ inputs:
5050
Relative paths of the artifacts for which to generate a provenance attestation (glob pattern).
5151
Default is collected from '.attestation-artifacts/' directory
5252
default: ''
53+
generate-summary:
54+
description: Whether to generate a workflow summary after the build.
55+
default: 'true'
56+
5357
outputs:
5458
project-version:
5559
description: The project version from package.json
@@ -173,15 +177,16 @@ runs:
173177
subject-path: >-
174178
${{ inputs.provenance-artifact-paths != '' && inputs.provenance-artifact-paths || steps.build.outputs.artifact-paths }}
175179
show-summary: true
180+
176181
- name: Generate workflow summary
177-
if: always()
182+
if: always() && inputs.generate-summary != 'false'
178183
shell: bash
179184
env:
180185
ARTIFACTORY_URL: ${{ inputs.repox-artifactory-url != '' && inputs.repox-artifactory-url ||
181186
format('{0}/artifactory', inputs.repox-url) }}
182187
run: |
183188
build_name="${GITHUB_REPOSITORY#*/}"
184-
echo "## 📦 Yarn Build Summary" >> $GITHUB_STEP_SUMMARY
189+
echo "## 📦 Yarn Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
185190
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
186191
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
187192
else
@@ -194,7 +199,7 @@ runs:
194199
echo "- **Branch**: \`${GITHUB_REF}\`" >> $GITHUB_STEP_SUMMARY
195200
echo "- **Commit**: \`$GITHUB_SHA\`" >> $GITHUB_STEP_SUMMARY
196201
197-
if [[ "${{ steps.build.outputs.should-deploy }}" == true ]]; then
202+
if [[ "${{ steps.build.outputs.deployed }}" == true ]]; then
198203
echo "### 🚀 Deployment" >> $GITHUB_STEP_SUMMARY
199204
ARTIFACTORY_BROWSE_URL="${ARTIFACTORY_URL%/*}/ui/builds/$build_name/$BUILD_NUMBER"
200205
echo "🔗 **[Browse artifacts in Artifactory](${ARTIFACTORY_BROWSE_URL})**" >> $GITHUB_STEP_SUMMARY

promote/promote.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
# - ARTIFACTORY_PROMOTE_ACCESS_TOKEN: Access token to promote builds
66
# - BUILD_NUMBER: Build number (e.g. 42)
77
# - BUILD_NAME: Name of the JFrog Artifactory build (e.g. sonar-dummy)
8+
# - GITHUB_TOKEN: GitHub token with repo access to update commit status
89
#
910
# GitHub Actions auto-provided:
1011
# - GITHUB_REF_NAME: Short ref name of the branch or tag (e.g. main, branch-123, dogfood-on-123)
1112
# - GITHUB_REPOSITORY: Repository name (e.g. sonarsource/sonar-dummy)
1213
# - GITHUB_EVENT_NAME: Event name (e.g. push, pull_request)
1314
# - GITHUB_EVENT_PATH: Path to the event webhook payload file. For example, /github/workflow/event.json.
15+
# - GITHUB_SHA: Git commit SHA that triggered the workflow
16+
# - GITHUB_JOB: The job_id of the current job, used for generating workflow summary
1417
#
1518
# Optional user customization:
1619
# - ARTIFACTORY_URL: Repox URL.
@@ -34,7 +37,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/../shared/common-functions.sh"
3437
: "${ARTIFACTORY_URL:="https://repox.jfrog.io/artifactory"}"
3538
: "${ARTIFACTORY_PROMOTE_ACCESS_TOKEN:?}"
3639
: "${GITHUB_REF_NAME:?}" "${BUILD_NUMBER:?}" "${GITHUB_REPOSITORY:?}" "${GITHUB_EVENT_NAME:?}" "${GITHUB_EVENT_PATH:?}" "${GITHUB_TOKEN:?}"
37-
: "${GITHUB_SHA:?}"
40+
: "${GITHUB_SHA:?}" "${GITHUB_JOB:?}"
3841
GH_API_VERSION_HEADER="X-GitHub-Api-Version: 2022-11-28"
3942
BUILD_INFO_FILE=$(mktemp)
4043
rm -f "$BUILD_INFO_FILE"
@@ -186,7 +189,7 @@ generate_workflow_summary() {
186189

187190

188191
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
189-
## 🚀 Promotion Summary
192+
## 🚀 Promotion Summary (\`${GITHUB_JOB}\`)
190193
191194
✅ **Promotion SUCCESS**
192195

spec/promote_spec.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export BUILD_NAME="dummy-project"
4747
export BUILD_NUMBER="42"
4848
export DEFAULT_BRANCH="main"
4949
export GITHUB_EVENT_NAME="push"
50+
export GITHUB_JOB="dummy-job"
5051
export GITHUB_REF="refs/heads/dummy-branch"
5152
export GITHUB_REF_NAME="dummy-branch"
5253
export GITHUB_REPOSITORY="SonarSource/dummy-project"

0 commit comments

Comments
 (0)