Skip to content

Commit f77764d

Browse files
changelog: stricter preview workflow (#5898)
## Changes 1. Run validation during changelog-preview 2. Formatting of the preview ## Why 1. So a misplaced file (e.g. `.nextchanges/my-change.md`) fails the workflow 2. To show the rendered markdown in the action summary ## Tests - Added bad file (bc8526f), https://github.com/databricks/cli/actions/runs/29205073987?pr=5898 - Added good file (3308219), https://github.com/databricks/cli/actions/runs/29205217338
1 parent 9b498de commit f77764d

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

.github/workflows/changelog-preview.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Changelog Preview
22

33
# Renders the CHANGELOG.md section the next release would generate from this
4-
# PR's .nextchanges/ fragments, so reviewers can see the result (in this check's
5-
# logs / summary) without cutting a release.
4+
# PR's .nextchanges/ fragments into this check's job summary, so reviewers see
5+
# the rendered changelog without cutting a release. Fails the check if a
6+
# fragment is misplaced (so it can't be silently skipped by the renderer).
67
#
78
# Uses `pull_request` with a read-only token: it renders the PR's own
89
# .nextchanges/ content and never needs write credentials.
@@ -30,16 +31,25 @@ jobs:
3031
with:
3132
version: "0.8.9"
3233

34+
# Fail the check on a misplaced/unexpected file under .nextchanges/ so it
35+
# can't slip through as a silently-skipped (unrendered) fragment.
36+
- name: Validate .nextchanges placement
37+
run: uv run tools/validate_nextchanges.py
38+
3339
- name: Render changelog preview
3440
run: |-
41+
# Render into a variable first so a renderer error fails this step
42+
# (rather than being swallowed by a pipe), then emit the .md directly
43+
# into the job summary so GitHub renders it as the changelog.
44+
preview=$(uv run --locked internal/genkit/release_tagging.py --preview)
3545
{
36-
echo '### Changelog preview'
46+
echo '## Changelog preview'
47+
echo ''
48+
echo 'This is a preview of what the next release would add to CHANGELOG.md based on `.nextchanges/`.'
3749
echo ''
38-
echo "What the next release would add to CHANGELOG.md from this PR's .nextchanges/:"
50+
echo '_NOTE: the date and version are computed at release time._'
3951
echo ''
40-
echo '```markdown'
41-
uv run --locked internal/genkit/release_tagging.py --preview
42-
echo '```'
52+
echo '---'
4353
echo ''
44-
echo '_Preview only — the date and version are computed at release time._'
45-
} | tee "$GITHUB_STEP_SUMMARY"
54+
echo "$preview"
55+
} >> "$GITHUB_STEP_SUMMARY"

Taskfile.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ tasks:
295295
changelog-preview:
296296
desc: Print the CHANGELOG.md section the next release would add from .nextchanges/
297297
cmds:
298+
# Validate placement first so a misplaced fragment fails loudly instead of
299+
# being silently skipped by the renderer (see validate_nextchanges.py).
300+
- task: check-changelog
298301
- "uv run --locked internal/genkit/release_tagging.py --preview"
299302

300303
deadcode:

0 commit comments

Comments
 (0)