Skip to content

Commit 01a9a8b

Browse files
authored
new changelog-build (#367)
Signed-off-by: Pablo Garay <[email protected]>
1 parent 8ca8f79 commit 01a9a8b

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

.github/workflows/changelog-build.yml

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
description: Release branch to build changelog on (e.g. `r2.1.0`)
1212
type: string
1313
required: true
14+
changelog-main-content:
15+
description: Custom changelog content to include before detailed changelogs
16+
type: string
17+
required: false
18+
default: ''
1419

1520
jobs:
1621
changelog:
@@ -33,8 +38,8 @@ jobs:
3338
# fromTag: Auto resolved from historical tag order (previous tag compared to current tag)
3439
# toTag: Current tag reference
3540
configuration: ".github/workflows/config/changelog-config.json"
36-
owner: "NVIDIA"
37-
repo: "NeMo"
41+
owner: ${{ github.repository_owner }}
42+
repo: ${{ github.event.repository.name }}
3843
ignorePreReleases: "false"
3944
failOnError: "false"
4045
fromTag: ${{ inputs.last-release-tag }}
@@ -44,12 +49,24 @@ jobs:
4449
env:
4550
RELEASE_BRANCH: ${{ inputs.release-branch }}
4651
CHANGELOG: ${{ steps.github_tag.outputs.changelog }}
52+
MAIN_CONTENT: ${{ inputs.changelog-main-content }}
4753
shell: bash -x -e -u -o pipefail {0}
4854
run: |
4955
RELEASE_VERSION=${RELEASE_BRANCH#r}
5056
CHANGELOG=$(echo "$CHANGELOG" | sed '/^[[:blank:]]*#/s/#/###/')
5157
52-
RELEASE_NOTES="## NVIDIA Nemo Run $RELEASE_VERSION
58+
# Build release notes starting with version header
59+
RELEASE_NOTES="## NVIDIA Nemo Run $RELEASE_VERSION"
60+
61+
# Add custom content if provided
62+
if [ -n "$MAIN_CONTENT" ]; then
63+
RELEASE_NOTES="$RELEASE_NOTES
64+
65+
$MAIN_CONTENT"
66+
fi
67+
68+
# Add detailed changelogs section
69+
RELEASE_NOTES="$RELEASE_NOTES
5370
5471
### Detailed Changelogs:
5572
@@ -62,6 +79,38 @@ jobs:
6279
- name: Inspect new changelog file
6380
run: cat CHANGELOG.md
6481

82+
- name: Create or update label
83+
uses: actions/github-script@v6
84+
with:
85+
script: |
86+
const labelName = '${{ inputs.release-branch }}';
87+
const labelColor = '0366d6'; // Blue color
88+
const labelDescription = `Release ${labelName}`;
89+
90+
try {
91+
// Try to get the label
92+
await github.rest.issues.getLabel({
93+
owner: context.repo.owner,
94+
repo: context.repo.repo,
95+
name: labelName
96+
});
97+
console.log(`Label '${labelName}' already exists`);
98+
} catch (error) {
99+
if (error.status === 404) {
100+
// Label doesn't exist, create it
101+
await github.rest.issues.createLabel({
102+
owner: context.repo.owner,
103+
repo: context.repo.repo,
104+
name: labelName,
105+
color: labelColor,
106+
description: labelDescription
107+
});
108+
console.log(`Created label '${labelName}'`);
109+
} else {
110+
throw error;
111+
}
112+
}
113+
65114
- name: Create Pull Request
66115
uses: peter-evans/create-pull-request@v7
67116
with:
@@ -71,3 +120,4 @@ jobs:
71120
sign-commits: true
72121
base: main
73122
branch: bot/chore/update-changelog-into-${{ inputs.release-branch }}
123+
labels: ${{ inputs.release-branch }}

0 commit comments

Comments
 (0)