Skip to content

Commit b0c3e42

Browse files
authored
Updated Travis CI release changelog generation (#156)
- Handle GitHub milestone titles that containing the release tag, but don't match it exactly (e.g. WWA v0.7.0) - Repair and simplify GitHub milestone description - Remove unnecessary parenthesis around GitHub issue links
1 parent 0bd4463 commit b0c3e42

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

travis/changelog.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,23 @@ echo "######Released on $(date '+%Y-%m-%d')"
99
GITHUB_API_URL="https://api.github.com/repos/${TRAVIS_REPO_SLUG}"
1010
MILESTONE_ARRAY=( \
1111
$(curl --silent "${GITHUB_API_URL}/milestones?state=all" \
12-
| jq --arg title "${TRAVIS_TAG}" '.[] | select(.title == $title) | .number') \
12+
| jq --arg title "${TRAVIS_TAG}" '.[] | select(.title | contains($title)) | .number') \
1313
) > /dev/null
1414

1515
# When GitHub has a milestone matching the Git tag, write milestone related information to the change log
1616
if [[ "${#MILESTONE_ARRAY[@]}" -ne 0 ]]; then
1717
# Write the milestone description to the change log
1818
MILESTONE_DESCRIPTION=( \
1919
$(curl --silent "${GITHUB_API_URL}/milestones/${MILESTONE_ARRAY[0]}" \
20-
| jq .description) \
20+
| jq .description --raw-output) \
2121
) > /dev/null
22-
MILESTONE_DESCRIPTION=${MILESTONE_DESCRIPTION[*]#\"}
23-
echo ${MILESTONE_DESCRIPTION[*]%\"}
22+
echo "${MILESTONE_DESCRIPTION[*]}"
2423

2524
# Write the milestone's associated issues to the change log with each issue on a separate line with the issue
2625
# title, issue number, and a link to the issue on GitHub.com, all in markdown format: .title ([#.number](.html_url))
2726
ISSUE_ARRAY=$(curl --silent "${GITHUB_API_URL}/issues?state=all&milestone=${MILESTONE_ARRAY[0]}" | jq -c '.[] | [.title, .number, .html_url]') >> /dev/null
2827
while read line
2928
do
30-
echo ${line} | sed 's#\["\(.*\)",\(.*\),"\(.*\)"\]#- \1 ([\#\2](\3))#'
29+
echo ${line} | sed 's#\["\(.*\)",\(.*\),"\(.*\)"\]#- \1 [\#\2](\3)#'
3130
done <<< "${ISSUE_ARRAY[*]}"
3231
fi

0 commit comments

Comments
 (0)