forked from EverythingSuckz/TG-FileStreamBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_changelogs.sh
More file actions
27 lines (22 loc) · 1004 Bytes
/
Copy pathgenerate_changelogs.sh
File metadata and controls
27 lines (22 loc) · 1004 Bytes
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
#!/bin/bash
# set -x
echo "## CHANGELOGS"
last_commit=$(curl -s https://api.github.com/repos/EverythingSuckz/TG-FileStreamBot/tags | jq -r '.[0].commit.sha')
resp=$(curl -s https://api.github.com/repos/EverythingSuckz/TG-FileStreamBot/commits?per_page=5)
data=$(echo "${resp}" | jq -c '.[]')
while read -r i; do
if [[ $i == $last_commit ]]; then
break
fi
sha=$(echo $i | jq -r '.sha')
message=$(echo $i | jq -r '.commit.message' | tr '\n' ' ')
commit_url=$(echo $i | jq -r '.html_url')
author_name=$(echo $i | jq -r '.commit.author.name')
author_url=$(echo $i | jq -r '.author.html_url')
echo "- [$(echo $sha | cut -c1-7)]($commit_url) - $message by [$author_name]($author_url)"
done <<< "$data"
if [[ ! -z "$last_commit" ]]; then
last_commit="main"
fi
compare_url="https://github.com/EverythingSuckz/TG-FileStreamBot/compare/$(echo $resp | jq -r '.[0].sha')...$last_commit"
echo -e "- [.....]($compare_url)\n\nView Full Changelogs [here]($compare_url)"