Add an option to turn off title for posts because on Mastodon a title is a content warning.
This commit is contained in:
parent
c73a264694
commit
3a9f9514b2
@ -5,13 +5,16 @@
|
||||
# To temperarily turn off posting, in project root:
|
||||
# touch .git/ignorepost
|
||||
|
||||
# Configuration variables
|
||||
# Post titles: On Mastodon this is a content warning, so you may want to turn it off.
|
||||
title=true
|
||||
|
||||
|
||||
# Check if .git/ignorepost exists - if so, exit silently
|
||||
if [[ -f ".git/ignorepost" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Do not allow errors
|
||||
set -e
|
||||
|
||||
remote="$1"
|
||||
url="$2"
|
||||
@ -31,8 +34,8 @@ project="${project%.git}"
|
||||
# Get pusher's name from git config more safely
|
||||
pusher="$(git config user.name)"
|
||||
if [[ -z "$pusher" ]]; then
|
||||
echo "Error: Could not determine user name from git config"
|
||||
exit 1
|
||||
echo "Error: Could not determine user name from git config. Pushing anyway."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Initialize message
|
||||
@ -59,8 +62,8 @@ while read localRef localSha remoteRef remoteSha; do
|
||||
|
||||
# Verify we can access the commit
|
||||
if ! git cat-file -e "$localSha"; then
|
||||
echo "Error: Cannot access commit $localSha"
|
||||
exit 1
|
||||
echo "Error: Cannot access commit $localSha. Pushing anyway."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get latest commit message
|
||||
@ -98,7 +101,11 @@ fi
|
||||
|
||||
# Only post if we have something to say
|
||||
if [[ -n "$message" ]]; then
|
||||
if [[ "${title}" == "true" ]]; then
|
||||
toot post -v public -p "$project" -t "text/markdown" "$message" &> /dev/null
|
||||
else
|
||||
toot post -v public -t "text/markdown" "$message" &> /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user