From 95c360996a2f2b2af9b8cc19966f474ce42c57cc Mon Sep 17 00:00:00 2001 From: Loric ANDRE Date: Thu, 16 Jul 2026 12:06:48 +0200 Subject: [PATCH] ci: add changelog as job output --- .github/workflows/release-pr.yml | 16 ++++++++++++++++ cliff.toml | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 8270f41d..307b04e3 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.version.outputs.version }} + changelog: ${{ steps.changelog.outputs.content }} steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 with: @@ -56,6 +57,18 @@ jobs: echo "$VERSION" > shell/version.txt git diff --binary -- CHANGELOG.md Cargo.lock Cargo.toml man shell > "$RUNNER_TEMP/release.patch" test -s "$RUNNER_TEMP/release.patch" + - id: changelog + name: Render release changelog + if: steps.version.outputs.version != '' + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + delimiter="changelog-$(cat /proc/sys/kernel/random/uuid)" + { + echo "content<<$delimiter" + git cliff -u -t "v$VERSION" --strip all + echo "$delimiter" + } >> "$GITHUB_OUTPUT" - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 if: steps.version.outputs.version != '' with: @@ -103,6 +116,7 @@ jobs: env: GH_TOKEN: ${{ steps.app-token.outputs.token }} VERSION: ${{ needs.prepare.outputs.version }} + CHANGELOG: ${{ needs.prepare.outputs.changelog }} shell: bash run: | auth="$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0)" @@ -112,7 +126,9 @@ jobs: Automated release preparation for v$VERSION. This branch is rebuilt from master as one commit on every push. Merge it with the repository's required squash merge; the resulting commit will be tagged v$VERSION and picked up by the release workflow. + EOF + printf '%s\n' "$CHANGELOG" >> "$RUNNER_TEMP/pr-body.md" pr="$(gh pr list --base master --head release-pr --state open --json number --jq '.[0].number')" if [[ -n "$pr" ]]; then diff --git a/cliff.toml b/cliff.toml index a7e3f0de..b0e01c5f 100644 --- a/cliff.toml +++ b/cliff.toml @@ -91,15 +91,16 @@ commit_parsers = [ { message = "^refactor", group = "๐Ÿšœ Refactor" }, { message = "^style", group = "๐ŸŽจ Styling" }, { message = "^test", group = "๐Ÿงช Testing" }, + { message = "^ci", group = "๐Ÿค– CI" }, { message = "^chore\\(release\\): prepare for", skip = true }, { message = "^chore\\(deps.*\\)", skip = true }, { message = "^chore\\(pr\\)", skip = true }, { message = "^chore\\(pull\\)", skip = true }, - { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, - { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, - { message = "^revert", group = "โ—€๏ธ Revert" }, + { message = "^chore", group = "โš™๏ธ Miscellaneous Tasks" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, { message = "^release", skip = true }, - { message = ".*", group = "๐Ÿ’ผ Other" }, + { message = ".*", group = "๐Ÿ’ผ Other" }, ] # Exclude commits that are not matched by any commit parser. filter_commits = false