-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script to get list of links to changes since previous commit (#504)
* changes script * full
- Loading branch information
1 parent
e7bc40d
commit 1cdca0f
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |