Skip to content

Commit 1cdca0f

Browse files
Script to get list of links to changes since previous commit (#504)
* changes script * full
1 parent e7bc40d commit 1cdca0f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Generate a list of markdown formatted changes since the supplied `previous-commit`.
4+
# You'd run this script like this:
5+
# ./scripts/get_changes_since_commit.sh --previous-commit 1d2e083acdd88d0829ad31e3a1725e3898565fda
6+
7+
while [ "$#" -gt 0 ]; do
8+
case "$1" in
9+
--previous-commit)
10+
previouscommit=($2)
11+
shift 2
12+
;;
13+
*)
14+
echo "Unknown option: $1"
15+
exit 1
16+
;;
17+
esac
18+
done
19+
20+
if [ -z "$previouscommit" ]; then
21+
echo "Missing --previous-commit"
22+
exit 1
23+
fi
24+
25+
currentcommit=$(git rev-parse HEAD)
26+
27+
# Get the commit messages between the previous commit and now.
28+
messages=$(git log --pretty=format:"%h %s" $previouscommit..$currentcommit)
29+
30+
function geturl() {
31+
echo "https://github.com/aptos-labs/aptos-indexer-processors/commit/$1"
32+
}
33+
34+
cat <<EOF
35+
Full changes since $previouscommit (newest first):
36+
EOF
37+
38+
while IFS= read -r line; do
39+
sha=$(echo "$line" | cut -d ' ' -f1)
40+
message=$(echo "$line" | cut -d ' ' -f2-)
41+
echo "- [$sha]($(geturl $sha)): $message"
42+
done <<< "$messages"
43+
44+
cat <<EOF
45+
EOF

0 commit comments

Comments
 (0)