Skip to content
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

chore: fix release note generation script #647

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ lint-install:
lint: lint-install
echo "--> Running linter"
@golangci-lint run --build-tags=$(GO_BUILD) --out-format=tab
@if [ $$(find . -name '*.go' -type f | xargs grep 'nolint\|#nosec' | wc -l) -ne 43 ]; then \
@if [ $$(find . -name '*.go' -type f | xargs grep 'nolint\|#nosec' | wc -l) -ne 45 ]; then \
echo "\033[91m--> increase or decrease nolint, please recheck them\033[0m"; \
echo "\033[91m--> list nolint: \`find . -name '*.go' -type f | xargs grep 'nolint\|#nosec'\`\033[0m"; exit 1;\
fi
Expand Down
8 changes: 3 additions & 5 deletions contrib/scripts/release-note.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ set -o errexit -o nounset
function find_change_log() {
local file="$1"
local version="$2"
local changelogs
changelogs="$(cat "$file")"
local i
i="$(echo "$changelogs" | grep -n "\[$version" | cut -d: -f1)"
i="$(grep -n "\[$version\]" "$file" | cut -d: -f1 | head -n 1)"
if [[ -z "$i" ]]; then
echo "cannot find version $version" >&2 && return
fi
local j
j="$(echo "$changelogs" | tail -n +"$i" | grep -n "\-\-\-" | cut -d: -f1 | head -n 1)"
j="$(tail -n +"$i" "$file" | grep -n "\-\-\-" | cut -d: -f1 | head -n 1)"
if [[ -z "$j" ]]; then
echo "cannot find the end of $version's changelog" >&2 && exit 1
fi
echo "$changelogs" | tail -n +"$i" | head -n "$j"
tail -n +"$i" "$file" | head -n "$j"
}

version=${1:-$VERSION}
Expand Down