changelog/hooks-output/changelog-server.sh

16 lines
486 B
Bash

#!/bin/bash
HOOKS_OUTPUT+=( hookOutputChangelogServer )
CHANGELOG_SERVER=http://localhost:3000
hookOutputChangelogServer(){
[[ -z "$1" ]] && echo "Sending changelog to remote server" && return
CONTENT=$(jq -aRs . $1|tr '"' '\"')
PAYLOAD="{\"author\":\"$CHANGELOG_USERNAME\",\"server\":\"$(hostname -f)\",\"content\":${CONTENT}}"
URL=$( curl -X POST -H "Content-Type: application/json" -s -d "${PAYLOAD}" "$CHANGELOG_SERVER/changelog/_doc"; )
echo "$FILE: $URL" >> $TMP
}