Skip to content

Commit

Permalink
Script to get list of links to changes since previous commit (#504)
Browse files Browse the repository at this point in the history
* changes script

* full
  • Loading branch information
just-in-chang authored Sep 11, 2024
1 parent e7bc40d commit 1cdca0f
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions scripts/get_changes_since_commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# Generate a list of markdown formatted changes since the supplied `previous-commit`.
# You'd run this script like this:
# ./scripts/get_changes_since_commit.sh --previous-commit 1d2e083acdd88d0829ad31e3a1725e3898565fda

while [ "$#" -gt 0 ]; do
case "$1" in
--previous-commit)
previouscommit=($2)
shift 2
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done

if [ -z "$previouscommit" ]; then
echo "Missing --previous-commit"
exit 1
fi

currentcommit=$(git rev-parse HEAD)

# Get the commit messages between the previous commit and now.
messages=$(git log --pretty=format:"%h %s" $previouscommit..$currentcommit)

function geturl() {
echo "https://github.com/aptos-labs/aptos-indexer-processors/commit/$1"
}

cat <<EOF
Full changes since $previouscommit (newest first):
EOF

while IFS= read -r line; do
sha=$(echo "$line" | cut -d ' ' -f1)
message=$(echo "$line" | cut -d ' ' -f2-)
echo "- [$sha]($(geturl $sha)): $message"
done <<< "$messages"

cat <<EOF
EOF

0 comments on commit 1cdca0f

Please sign in to comment.