1#!/bin/sh
2
3set -e
4
5readlog() {
6 git log --format=format:"%h%n%H%n%an%n%s%n%d%n"
7}
8
9PROJECT_USERNAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
10PROJECT_REPONAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
11
12hash_abrev=''
13hash=''
14author=''
15title=''
16
17c=0
18t=0
19readlog |
20while IFS= read -r lineVAR; do
21 if [ "$c" = '0' ]; then
22 hash_abrev="$lineVAR"
23 fi
24 if [ "$c" = '1' ]; then
25 hash="$lineVAR"
26 fi
27 if [ "$c" = '2' ]; then
28 author="$lineVAR"
29 fi
30 if [ "$c" = '3' ]; then
31 title="$lineVAR"
32 fi
33 if [ "$c" = '4' ]; then
34 if [ ! -z "$lineVAR" ]; then
35 t=$(($t+1))
36 fi
37 if [ "$t" = '2' ]; then
38 break
39 fi
40 echo "<li><a href='https://github.com/nektro/$PROJECT_REPONAME/commit/$hash'><code>$hash_abrev</code></a> $title ($author)</li>"
41 fi
42 c=$(($c+1))
43 #
44 if [ "$c" = '6' ]; then
45 c=0
46 fi
47done