-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub_changelog.sh
54 lines (44 loc) · 973 Bytes
/
github_changelog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
HELP=0
MILESTONE=""
REPO=""
#
# Process script arguments
#
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-m)
MILESTONE="${2}"
shift
;;
-r)
REPO="${2}"
shift
;;
-h|--help)
HELP=1
;;
*)
echo "Unkown option: $key"
HELP=1
;;
esac
shift # past argument or value
done
if [ "${REPO}" == "" ]; then
echo "REPO (-r <value>) is required"
exit 1
fi
if [ "${MILESTONE}" == "" ]; then
echo "MILESTONE (-m <value>) is required"
exit 1
fi
# This uses jq; see https://stedolan.github.io/jq/
# Use 'brew install jq' on Mac
STATE="all"
MILESTONE_URI="https://api.github.com/repos/clarin-eric/${REPO}/milestones/${MILESTONE}"
ISSUES_URI="https://api.github.com/repos/clarin-eric/${REPO}/issues?milestone=${MILESTONE}&state=${STATE}"
curl -s "${MILESTONE_URI}" | jq -r ".title"
curl -s "$ISSUES_URI" | jq -r ".[] | (\"* \" + .title), \" <\" + .html_url + \">\""