Skip to content
Merged
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
11 changes: 9 additions & 2 deletions tools/changelog-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,17 @@ check_or_add_pr() {
return
fi
checked_ids[$id]=1
local json=$(gh pr view "${id/#/}" --json title,author)
if grep -qE "#$id\>" <<<"$changelog"; then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment on what this does and why, please.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And, perhaps - like the "not merged" below - echo a message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment on what this does and why, please.

Done.

And, perhaps - like the "not merged" below - echo a message.

Hm, I'm not convinced. It was generally nice to see that repeated invocations of this script added less and less stuff (e.g. when run again later in the release process). If we generate a line of output of each PR even if it was already there, the output becomes harder to read, IMO. If you feel strongly, I can add it though.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's why I was hesitant. Probably best without.

# Changelog already lists this PR ID -> nothing to do
# (\> ensures that we only match full, standalone IDs)
return
fi
local json=$(gh pr view "${id/#/}" --json title,author,state)
local state=$(jq -r .state <<<"${json}")
local title=$(jq -r .title <<<"${json}" | sanitize_title)
local author=$(jq -r .author.login <<<"${json}")
if grep -qF "#$id" <<<"$changelog"; then
if [[ "${state}" != "MERGED" ]]; then
echo "-> Ignoring PR #${id} as state ${state} != MERGED"
return
fi
local title_suggestion_in_pr=$(gh pr view "$id" --json body,comments,reviews --jq '(.body), (.comments[] .body), (.reviews[] .body)' | grep -oP '\bCHANGELOG:\s*\K([^\\]{5,})' | tail -n1 | sanitize_title)
Expand Down