2023-02-05 14:18:41 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Requires toot: https://github.com/ihabunek/toot
|
|
|
|
# remote is $1 e.g. origin
|
|
|
|
# url is $2
|
|
|
|
url="${2#*@}"
|
|
|
|
url="${url%.git}"
|
2023-05-26 10:08:56 -04:00
|
|
|
url="${url#*://}"
|
2023-02-05 14:18:41 -05:00
|
|
|
shopt -s extglob
|
2023-05-26 10:20:38 -04:00
|
|
|
url="${url/:+([0-9])/}"
|
2023-05-26 10:08:56 -04:00
|
|
|
url="https://${url}"
|
2023-02-05 14:18:41 -05:00
|
|
|
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 --quiet -v public -p "$project" -t "text/markdown" "$pusher pushed changes to the $branch branch of the [$project project]($url)
|
|
|
|
$commit"
|
|
|
|
exit 0
|