diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-08-06 21:26:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-07 04:26:30 +0000 |
| commit | 1088e57b63ae49be885d312dfad6e02057f29083 (patch) | |
| tree | 33ea42a60ce3982591a2498a3dd0ead3b5e4aa72 | |
| parent | f241b1438104973d719926eb74e2195715d7608a (diff) | |
Add a new option to use hash for release-note script (#8096)
This commit adds a new command-line argument for
`docs/script/release-note.sh`, which is `--previous-release-hash`.
It will allow us to generate the release note at more finer granularity.
The current help message is following,
```
Usage: ./docs/scripts/release-note.sh [--since DATE | --previous-release-hash HASH]
--since DATE Generate notes since the given date (e.g., 2025-08-06)
--previous-release-hash HASH Generate notes since the given commit hash
Legacy usage (deprecated): ./docs/scripts/release-note.sh DATE
```
Fixes
- https://github.com/shader-slang/slang/issues/5188
- https://github.com/shader-slang/slang/issues/6887
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
| -rw-r--r-- | docs/scripts/release-note.sh | 101 |
1 files changed, 72 insertions, 29 deletions
diff --git a/docs/scripts/release-note.sh b/docs/scripts/release-note.sh index 9ee85d0fe..0604f7fe6 100644 --- a/docs/scripts/release-note.sh +++ b/docs/scripts/release-note.sh @@ -3,11 +3,11 @@ # It prints information about breaking-changes first and the rest. # The content is mostly based on `git log --oneline --since 202X-YY-ZZ`. -# Usage: the script takes one command-line argument that will be used on '-since' option of git command. -# As an example, you can run a script with a following command, and it will print commit titles between today and 2024-07-01. -# ``` -# docs/scripts/release-note.sh 2024-07-01 -# ``` +# Usage: the script takes command-line arguments to specify the range of commits to include. +# You can use either: +# 1. Date-based range with --since: docs/scripts/release-note.sh --since 2025-08-06 +# 2. Hash-based range with --previous-hash: docs/scripts/release-note.sh --previous-hash abc123 +# 3. Legacy positional argument (deprecated): docs/scripts/release-note.sh 2024-07-01 # This script is supposed to work on all Windows based shell systems including WSL and git-bash. # If you make any modifications, please test them, because CI doesn't test this script. @@ -16,44 +16,89 @@ verbose=true $verbose && echo "Reminder: PLEASE make sure your local repo is up-to-date before running the script." >&2 gh="" -for candidate in "$(which gh.exe)" "/mnt/c/Program Files/GitHub CLI/gh.exe" "/c/Program Files/GitHub CLI/gh.exe" "/cygdrive/c/Program Files/GitHub CLI/gh.exe"; do +for candidate in \ + "$(which gh)" \ + "$(which gh.exe)" \ + "/mnt/c/Program Files/GitHub CLI/gh.exe" \ + "/c/Program Files/GitHub CLI/gh.exe" \ + "/cygdrive/c/Program Files/GitHub CLI/gh.exe"; do if [ -x "$candidate" ]; then gh="$candidate" break fi done -if [ "x$gh" = "x" ] || ! [ -x "$gh" ]; then - echo "File not found: gh.exe" - echo "gh.exe can be downloaded from https://cli.github.com" +if [ "$gh" = "" ] || ! [ -x "$gh" ]; then + echo "File not found: gh or gh.exe" + echo "GitHub CLI can be downloaded from https://cli.github.com" exit 1 fi -$verbose && echo "gh.exe is found from: $gh" >&2 +$verbose && echo "gh is found from: $gh" >&2 -if [ "x$1" = "x" ]; then - echo "This script requires 'since' information for git-log command." - echo "Usage: $0 2024-07-30" +# Parse command-line arguments +use_hash=false +since="" +previous_hash="" + +while [[ $# -gt 0 ]]; do + case $1 in + --since) + since="$2" + use_hash=false + shift 2 + ;; + --previous-hash) + previous_hash="$2" + use_hash=true + shift 2 + ;; + *) + # Legacy positional argument support + if [ "$since" = "" ] && [ "$previous_hash" = "" ]; then + since="$1" + use_hash=false + else + echo "Too many arguments or mixed argument styles" + exit 1 + fi + shift + ;; + esac +done + +# Validate arguments +if [ "$since" = "" ] && [ "$previous_hash" = "" ]; then + echo "This script requires either --since or --previous-hash option." + echo "Usage: $0 [--since DATE | --previous-hash HASH]" + echo " --since DATE Generate notes since the given date (e.g., 2025-08-06)" + echo " --previous-hash HASH Generate notes since the given commit hash" + echo "" + echo "Legacy usage (deprecated): $0 DATE" exit 1 fi -since="$1" -commits="$(git log --oneline --since $since)" +# Get commits based on the specified range +if [ "$use_hash" = true ]; then + commits="$(git log --oneline "$previous_hash"..HEAD)" +else + commits="$(git log --oneline --since "$since")" +fi commitsCount="$(echo "$commits" | wc -l)" echo "=== Breaking changes ===" breakingChanges="" -for i in $(seq $commitsCount); do - line="$(echo "$commits" | head -$i | tail -1)" +for i in $(seq "$commitsCount"); do + line="$(echo "$commits" | head -n "$i" | tail -1)" # Get PR number from the git commit title pr="$(echo "$line" | grep '#[1-9][0-9][0-9][0-9][0-9]*' | sed 's|.* (\#\([1-9][0-9][0-9][0-9][0-9]*\))|\1|')" - [ "x$pr" = "x" ] && continue + [ "$pr" = "" ] && continue # Check if the PR is marked as a breaking change - if "$gh" issue view $pr --json labels | grep -q 'pr: breaking change'; then + if "$gh" issue view "$pr" --json labels | grep -q 'pr: breaking change'; then breakingChanges+="$line" fi done -if [ "x$breakingChanges" = "x" ]; then +if [ "$breakingChanges" = "" ]; then echo "No breaking changes" else echo "$breakingChanges" @@ -61,19 +106,17 @@ fi echo "" echo "=== All changes for this release ===" -for i in $(seq $commitsCount); do - line="$(echo "$commits" | head -$i | tail -1)" +for i in $(seq "$commitsCount"); do + line="$(echo "$commits" | head -n "$i" | tail -1)" result="$line" - for dummy in 1; do - # Get PR number from the git commit title - pr="$(echo "$line" | grep '#[1-9][0-9][0-9][0-9][0-9]*' | sed 's|.* (\#\([1-9][0-9][0-9][0-9][0-9]*\))|\1|')" - [ "x$pr" = "x" ] && break - + # Get PR number from the git commit title + pr="$(echo "$line" | grep '#[1-9][0-9][0-9][0-9][0-9]*' | sed 's|.* (\#\([1-9][0-9][0-9][0-9][0-9]*\))|\1|')" + if [ "$pr" != "" ]; then # Mark breaking changes with "[BREAKING]" - if "$gh" issue view $pr --json labels | grep -q 'pr: breaking change'; then + if "$gh" issue view "$pr" --json labels | grep -q 'pr: breaking change'; then result="[BREAKING] $line" fi - done + fi echo "$result" done |
