Skip to content

Commit a10291b

Browse files
authored
Merge pull request #111 from SumoLogic/ssain-add-makefile-scripts
add change log script
2 parents 3b88d06 + 21fe168 commit a10291b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

scripts/changelog-links.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# This script rewrites [GH-nnnn]-style references in the CHANGELOG.md file to
4+
# be Markdown links to the given github issues.
5+
#
6+
# This is run during releases so that the issue references in all of the
7+
# released items are presented as clickable links, but we can just use the
8+
# easy [GH-nnnn] shorthand for quickly adding items to the "Unrelease" section
9+
# while merging things between releases.
10+
11+
set -e
12+
13+
if [[ ! -f CHANGELOG.md ]]; then
14+
echo "ERROR: CHANGELOG.md not found in pwd."
15+
echo "Please run this from the root of the terraform provider repository"
16+
exit 1
17+
fi
18+
19+
if [[ `uname` == "Darwin" ]]; then
20+
echo "Using BSD sed"
21+
SED="sed -i.bak -E -e"
22+
else
23+
echo "Using GNU sed"
24+
SED="sed -i.bak -r -e"
25+
fi
26+
27+
PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-github\/issues"
28+
29+
$SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md
30+
31+
rm CHANGELOG.md.bak

0 commit comments

Comments
 (0)