mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Updated Upstream ()
Upstream has released updates that appear to apply and compile correctly
This commit is contained in:
89
scripts/updateUpstream.sh
Normal file
89
scripts/updateUpstream.sh
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# requires curl & jq
|
||||||
|
|
||||||
|
# upstreamCommit --paper HASH --pufferfish HASH --purpur HASH
|
||||||
|
# flag: --paper HASH - the commit hash to use for comparing commits between paper (PaperMC/Paper/compare/HASH...HEAD)
|
||||||
|
# flag: --pufferfish HASH - the commit hash to use for comparing commits between pufferfish (pufferfish-gg/Pufferfish/compare/HASH...HEAD)
|
||||||
|
# flag: --purpur HASH - the commit hash to use for comparing commits between paper (PurpurMC/Purpur/compare/HASH...HEAD)
|
||||||
|
|
||||||
|
function getCommits() {
|
||||||
|
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/"$1"/compare/"$2"...HEAD | jq -r '.commits[] | "'"$1"'@\(.sha[:7]) \(.commit.message | split("\r\n")[0] | split("\n")[0])"'
|
||||||
|
}
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
PS1="$"
|
||||||
|
|
||||||
|
paperHash=""
|
||||||
|
pufferfishHash=""
|
||||||
|
purpurHash=""
|
||||||
|
|
||||||
|
TEMP=$(getopt --long paper:,pufferfish: -o "" -- "$@")
|
||||||
|
eval set -- "$TEMP"
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
--paper)
|
||||||
|
paperHash="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--pufferfish)
|
||||||
|
pufferfishHash="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
paper=""
|
||||||
|
pufferfish=""
|
||||||
|
purpur=""
|
||||||
|
updated=""
|
||||||
|
logsuffix=""
|
||||||
|
|
||||||
|
# Paper updates
|
||||||
|
if [ -n "$paperHash" ]; then
|
||||||
|
paper=$(getCommits "PaperMC/Paper" "$paperHash")
|
||||||
|
|
||||||
|
# Updates found
|
||||||
|
if [ -n "$paper" ]; then
|
||||||
|
updated="Paper"
|
||||||
|
logsuffix="$logsuffix\n\nPaper Changes:\n$paper"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pufferfish updates
|
||||||
|
if [ -n "$pufferfishHash" ]; then
|
||||||
|
pufferfish=$(getCommits "pufferfish-gg/Pufferfish" "$pufferfishHash")
|
||||||
|
|
||||||
|
# Updates found
|
||||||
|
if [ -n "$pufferfish" ]; then
|
||||||
|
updated="Pufferfish"
|
||||||
|
logsuffix="$logsuffix\n\nPufferfish Changes:\n$pufferfish"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Purpur updates
|
||||||
|
if [ -n "$purpurHash" ]; then
|
||||||
|
pufferfish=$(getCommits "PurpurMC/Purpur" "$purpurHash")
|
||||||
|
|
||||||
|
# Updates found
|
||||||
|
if [ -n "$purpur" ]; then
|
||||||
|
updated="Purpur"
|
||||||
|
logsuffix="$logsuffix\n\nPurpur Changes:\n$purpur"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Both have updates
|
||||||
|
if [ -n "$paper" ] && [ -n "$pufferfish" ] && [ -n "$purpur" ]; then
|
||||||
|
updated="Paper, Pufferfish & Purpur"
|
||||||
|
fi
|
||||||
|
|
||||||
|
disclaimer="Upstream has released updates that appear to apply and compile correctly"
|
||||||
|
log="Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}"
|
||||||
|
|
||||||
|
echo -e "$log" | git commit -F -
|
||||||
|
|
||||||
|
) || exit 1
|
||||||
Reference in New Issue
Block a user