diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-30 13:45:53 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-30 13:45:53 +0800 |
| commit | 22d1e345037eea853e54b84af718340cb9776513 (patch) | |
| tree | e63754ab1e7c7f6c95d75ff5bc785b9afdbd54b4 /docs/scripts/release-note.sh | |
| parent | 44dc5ea202ac43cd4f18c268e95143c2a23f5d26 (diff) | |
format yaml and json (#5428)
* format yaml and json
* format shell scripts
Diffstat (limited to 'docs/scripts/release-note.sh')
| -rw-r--r-- | docs/scripts/release-note.sh | 127 |
1 files changed, 58 insertions, 69 deletions
diff --git a/docs/scripts/release-note.sh b/docs/scripts/release-note.sh index 250873bb0..d63ee8736 100644 --- a/docs/scripts/release-note.sh +++ b/docs/scripts/release-note.sh @@ -16,27 +16,23 @@ 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 - if [ -x "$candidate" ] - then - gh="$candidate" - break - fi +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 + 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" - exit 1 +if [ "x$gh" = "x" ] || ! [ -x "$gh" ]; then + echo "File not found: gh.exe" + echo "gh.exe can be downloaded from https://cli.github.com" + exit 1 fi $verbose && echo "gh.exe 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" - exit 1 +if [ "x$1" = "x" ]; then + echo "This script requires 'since' information for git-log command." + echo "Usage: $0 2024-07-30" + exit 1 fi since="$1" @@ -45,62 +41,55 @@ commitsCount="$(echo "$commits" | wc -l)" echo "=== Breaking changes ===" breakingChanges="" -for i in $(seq $commitsCount) -do - line="$(echo "$commits" | head -$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 - - # Check if the PR is marked as a breaking change - if "$gh" issue view $pr --json labels | grep -q 'pr: breaking change' - then - breakingChanges+="$line" - fi +for i in $(seq $commitsCount); do + line="$(echo "$commits" | head -$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 + + # Check if the PR is marked as a breaking change + if "$gh" issue view $pr --json labels | grep -q 'pr: breaking change'; then + breakingChanges+="$line" + fi done -if [ "x$breakingChanges" = "x" ] -then - echo "No breaking changes" +if [ "x$breakingChanges" = "x" ]; then + echo "No breaking changes" else - echo "$breakingChanges" + echo "$breakingChanges" fi echo "" echo "=== All changes for this release ===" -for i in $(seq $commitsCount) -do - line="$(echo "$commits" | head -$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 - - # Mark breaking changes with "[BREAKING]" - if "$gh" issue view $pr --json labels | grep -q 'pr: breaking change' - then - result="[BREAKING] $line" - fi - - # Get the issue number for the PR - body="$("$gh" issue view $pr --json body)" - [ "x$body" = "x" ] && break - issue="$(echo "$body" | 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$issue" = "x" ] && break - - # Get the labels of the issue - label="$("$gh" issue view $issue --json labels)" - [ "x$label" = "x" ] && break - - # Get the goal type from the labels - goal="$(echo "$label" | grep '"goal:' | sed 's|.*"goal:\([^"]*\)".*|\1|')" - [ "x$goal" = "x" ] && break - - result+=" (#$issue:$goal)" - done - echo "$result" +for i in $(seq $commitsCount); do + line="$(echo "$commits" | head -$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 + + # Mark breaking changes with "[BREAKING]" + if "$gh" issue view $pr --json labels | grep -q 'pr: breaking change'; then + result="[BREAKING] $line" + fi + + # Get the issue number for the PR + body="$("$gh" issue view $pr --json body)" + [ "x$body" = "x" ] && break + issue="$(echo "$body" | 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$issue" = "x" ] && break + + # Get the labels of the issue + label="$("$gh" issue view $issue --json labels)" + [ "x$label" = "x" ] && break + + # Get the goal type from the labels + goal="$(echo "$label" | grep '"goal:' | sed 's|.*"goal:\([^"]*\)".*|\1|')" + [ "x$goal" = "x" ] && break + + result+=" (#$issue:$goal)" + done + echo "$result" done - |
