]> git.immae.eu Git - github/fretlink/terraform-provider-mailgun.git/blame - scripts/changelog-links.sh
add shellcheck to the makeffile and .travis.yml and fix the scripts to have no error...
[github/fretlink/terraform-provider-mailgun.git] / scripts / changelog-links.sh
CommitLineData
a1f9b9a1
AG
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
11set -e
12
13if [[ ! -f CHANGELOG.md ]]; then
065bf5d7
AG
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
a1f9b9a1
AG
17fi
18
065bf5d7
AG
19if [[ $(uname) == "Darwin" ]]; then
20 echo "Using BSD sed"
21 SED="sed -i.bak -E -e"
a1f9b9a1 22else
065bf5d7
AG
23 echo "Using GNU sed"
24 SED="sed -i.bak -r -e"
a1f9b9a1
AG
25fi
26
065bf5d7 27PROVIDER_URL="https:\\/\\/github.com\\/terraform-providers\\/terraform-provider-statuscake\\/issues"
a1f9b9a1 28
065bf5d7 29$SED "s/GH-([0-9]+)/\\[#\\1\\]\\($PROVIDER_URL\\/\\1\\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md
a1f9b9a1
AG
30
31rm CHANGELOG.md.bak