Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix changelog script for consistent PR links #482

Merged
merged 1 commit into from
Mar 21, 2022
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
6 changes: 3 additions & 3 deletions scripts/generate_changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

set -eu

REMOTE_LINK="https://github.com/paritytech/subxt/pull/"

function usage() {
cat <<HELP_USAGE
This script obtains the changelog between the latest release tag and origin/master.
Expand Down Expand Up @@ -37,8 +39,6 @@ GIT_BIN=$(which git) || log_error 'git is not installed. Please follow https://g
# Generate the changelog between the provided tag and origin/master.
function generate_changelog() {
local tag="$1"
# From the remote origin url, get a link to pull requests.
remote_link=$($GIT_BIN config --get remote.origin.url | sed 's/\.git/\/pull\//g') || log_error 'Failed to get remote origin url'

prs=$($GIT_BIN --no-pager log --pretty=format:"%s" "$tag"..origin/master) || log_error 'Failed to obtain commit list'

Expand All @@ -52,7 +52,7 @@ function generate_changelog() {
fi

# Generate a valid PR link.
pr_link="$remote_link$pr_number"
pr_link="$REMOTE_LINK$pr_number"
# Generate the link as markdown.
pr_md_link=" ([#$pr_number]($pr_link))"
# Print the changelog line as `- commit-title pr-link`.
Expand Down