-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changelog.sh
executable file
·47 lines (42 loc) · 957 Bytes
/
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
#!/bin/sh
set -eu
PROJECT_USERNAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
PROJECT_REPONAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
read-log() {
git log --format=format:"%h%n%H%n%an%n%s%n%d%n"
}
hash_abrev=''
hash=''
author=''
title=''
c=0
t=0
read-log |
while IFS= read -r lineVAR; do
if [[ "$c" == '0' ]]; then
hash_abrev="$lineVAR"
fi
if [[ "$c" == '1' ]]; then
hash="$lineVAR"
fi
if [[ "$c" == '2' ]]; then
author="$lineVAR"
fi
if [[ "$c" == '3' ]]; then
title="$lineVAR"
fi
if [[ "$c" == '4' ]]; then
if [ ! -z "$lineVAR" ]; then
t=$(($t+1))
fi
if [[ "$t" == '2' ]]; then
break
fi
echo "<li><a href='https://github.com/$PROJECT_USERNAME/$PROJECT_REPONAME/commit/$hash'><code>$hash_abrev</code></a> $title ($author)</li>"
fi
c=$(($c+1))
#
if [[ "$c" == '6' ]]; then
c=0
fi
done