generated from Zeronaut/nbco-hugo-web
All checks were successful
Deploy to Netlify / Deploy Hugo site to Netlify (push) Successful in 37s
21 lines
851 B
Bash
Executable File
21 lines
851 B
Bash
Executable File
#!/bin/bash
|
|
COMMIT=$(git log --oneline -1 --format=%s | sed 's/^.*: //')
|
|
echo $COMMIT
|
|
PREFIX="Post "
|
|
if [[ "$COMMIT" == "$PREFIX"* ]]; then
|
|
#echo "The commit message starts with Post "
|
|
#echo ${COMMIT:5}
|
|
SUBDIR=$(find content/posts -name "${COMMIT:5}*" -type d)
|
|
POST=${SUBDIR:14}
|
|
#echo $SUBDIR
|
|
TITLE=$(awk -v pat="title" -F":" '$0 ~ pat {print $2}' $SUBDIR/index.md)
|
|
#echo $TITLE
|
|
DESC=$(awk -v pat="description" -F":" '$0 ~ pat {print $2}' $SUBDIR/index.md)
|
|
#echo $DESC
|
|
echo "Preparing to post this to Mastodon"
|
|
echo "curl https://fosstodon.org/api/v1/statuses -H 'Authorization: Bearer kdKxV9v4Cv-GwhAd5YHDqI6xJsKT4KkFX89FlhPvBzw' -F 'status=Check out my latest blog post $TITLE about $DESC read more at https://allisthewave.com/posts/$POST'"
|
|
else
|
|
echo "The commit message does not start with Post, ignoring..."
|
|
fi
|
|
printf "\n"
|