Repository navigation
ci(release): list only CLI changes in CLI release notes #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aliasunder
merged 10 commits into
worktree-release-checkout-latest-main
from
ci/cli-release-notes-filter
Oct 22, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
93fd452
ci(release): list only CLI changes in CLI release notes
aliasunder 7e18567
test(release): list the CLI release-notes script in the shell-lint test
aliasunder 310214a
Merge remote-tracking branch 'origin/worktree-release-checkout-latest…
aliasunder 4e0a53e
fix(review): read quoted and spaced file names in CLI notes headers
aliasunder af6b895
style: clarify CLI release-notes rules and their docs
aliasunder fec72ab
test(ci): leave out a commit that adds comments to two .ts files
aliasunder ba5f9a9
ci(release): keep CLI notes correct under user git config and CRLF
aliasunder bdb123d
ci(release): list commits that add or rename a commented-out setting …
aliasunder 23ec04d
ci(release): drop CLI notes options that change nothing
aliasunder c2d7655
Merge remote-tracking branch 'origin/worktree-release-checkout-latest…
aliasunder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| #!/usr/bin/env bash | ||
| # List the commits since the previous CLI tag that change what a CLI user gets, | ||
| # one `- <subject>` line each, newest first. | ||
| # Usage: generate-cli-notes.sh <new-tag> | ||
| # | ||
| # A commit is listed when its diff under cli/ adds or removes a line that none | ||
| # of these rules skips: | ||
| # - blank lines | ||
| # - lines in files under cli/src/__tests__/ | ||
| # - the "version" line of cli/package.json (the release bump) | ||
| # - in .ts files, lines that start, after any indent, with #, //, /* or *: | ||
| # comments, and the comment text of the .env templates in cli/src/env.ts. | ||
| # A # line shaped like a setting (# KEY=value) still counts: the templates | ||
| # ship optional settings commented out, for the user to uncomment. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| NEW_TAG="${1:?Usage: generate-cli-notes.sh <new-tag>}" | ||
| # --match keeps server tags (v0.55.0) out. With no earlier CLI tag, the range | ||
| # is every commit reachable from new-tag. | ||
| PREV_TAG=$(git describe --tags --abbrev=0 --match "cli-v*" "$NEW_TAG"^ 2> /dev/null || echo "") | ||
|
|
||
| if [ -n "$PREV_TAG" ]; then | ||
| RANGE="${PREV_TAG}..${NEW_TAG}" | ||
| else | ||
| RANGE="$NEW_TAG" | ||
| fi | ||
|
|
||
| # Exits 0 when the patch on stdin adds or removes a counted line. | ||
| has_counted_change() { | ||
| awk ' | ||
| # A file header comes before its first @@ line, so a content line such as | ||
| # "--- x" (a removed "-- x") is never read as a header. | ||
| /^diff --git / { in_hunk = 0; path = ""; next } | ||
| /^@@/ { in_hunk = 1; next } | ||
| # Git quotes a name holding special characters and ends the header with a | ||
| # tab when the name holds a space. A /dev/null header (an added or deleted | ||
| # file) fails the match, so path comes from the other header. | ||
| !in_hunk && /^(---|\+\+\+) "?[ab]\// { | ||
| path = $0 | ||
| sub(/^(---|\+\+\+) "?[ab]\//, "", path) | ||
| sub(/"?\t?$/, "", path) | ||
| next | ||
| } | ||
|
aliasunder marked this conversation as resolved.
|
||
| !in_hunk { next } | ||
| /^[+-]/ { | ||
| content = substr($0, 2) | ||
| if (content ~ /^[ \t\r]*$/) next | ||
| if (path == "cli/package.json" && content ~ /^[ \t]*"version"[ \t]*:/) next | ||
| # Before the # skip below, so a commented-out setting (# KEY=value) counts. | ||
| if (path ~ /\.ts$/ && content ~ /^[ \t]*#[ \t]*[A-Z][A-Z0-9_]*=/) { found = 1; exit } | ||
| if (path ~ /\.ts$/ && content ~ /^[ \t]*(#|\/\/|\/\*|\*)/) next | ||
|
aliasunder marked this conversation as resolved.
|
||
| found = 1 | ||
| exit | ||
| } | ||
| END { exit found ? 0 : 1 } | ||
| ' | ||
| } | ||
|
|
||
| CLI_PATHSPEC=(cli/ ':(exclude)cli/src/__tests__/') | ||
|
|
||
| # Hex hashes only, so word splitting in the loop below is safe. Merge commits | ||
| # are skipped: the commits a merge brings in are checked on their own. | ||
| COMMIT_HASHES=$(git log --no-merges --format=%H "$RANGE" -- "${CLI_PATHSPEC[@]}") | ||
|
|
||
| for commit_hash in $COMMIT_HASHES; do | ||
|
aliasunder marked this conversation as resolved.
|
||
| PATCH=$(git diff-tree -p --root --no-commit-id -U0 "$commit_hash" -- "${CLI_PATHSPEC[@]}") | ||
| if has_counted_change <<< "$PATCH"; then | ||
| git show -s --format='- %s' "$commit_hash" | ||
| fi | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.