Added autoversion control pre-push hook. You may need to update links using the old pre-push as it has been renamed to pre-push-fediverse.

This commit is contained in:
Storm Dragon
2024-12-06 13:57:43 -05:00
parent 300ba28d73
commit 52861c89c8
2 changed files with 42 additions and 0 deletions

23
pre-push-fediverse Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Requires toot: https://github.com/ihabunek/toot
# remote is $1 e.g. origin
# url is $2
url="${2#*@}"
url="${url%.git}"
url="${url#*://}"
shopt -s extglob
url="${url/:+([0-9])/}"
url="https://${url}"
branch="$(git branch | grep "\* ")"
branch="${branch:2}"
commit="$(git log -1 --pretty=%B)"
project="${2##*/}"
project="${project%.git}"
pusher="$(git log | grep -m1 "Author: ")"
pusher="${pusher#Author: }"
pusher="${pusher% <*@*.*>}"
toot post -v public -p "$project" -t "text/markdown" "$pusher pushed changes to the $branch branch of the [$project project]($url)
$commit" &> /dev/null
exit 0