9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-21 16:09:19 +00:00
Files
Leaf/scripts/upstreamCommit.sh
Dreeam 5d0794b477 Updated Upstream (Paper/Gale)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@a6ceda1 distinguish between null and empty map in API (#10829)
PaperMC/Paper@506f165 Don't store removed components in multiple places (#11091)
PaperMC/Paper@ceeb8c1 Disable timings by default (#11095)
PaperMC/Paper@05ed6a6 Fix priority scheduling logic
PaperMC/Paper@967f98a Optimise chunk tick checking during chunk tick
PaperMC/Paper@00b949f Remove Moonrise utils to MCUtils, remove duplicated/unused utils
PaperMC/Paper@4efd24b Remove unused chunk system hooks in MCUtils
PaperMC/Paper@b653276 Finish chunk tick iteration optimisation port from Moonrise
PaperMC/Paper@2df5bba Log throwable when failing to save chunk/poi/entity data
PaperMC/Paper@44c3dd0 fix exact choice shapeless recipes (#10973)

Gale Changes:
Dreeam-qwq/Gale@004abb3 Fix auto update upstream
Dreeam-qwq/Gale@bbfd940 debug
Dreeam-qwq/Gale@52b68af Updated Upstream (Paper)
Dreeam-qwq/Gale@4a647c3 [ci skip] Remove debug commands in auto-update workflow
Dreeam-qwq/Gale@8241709 [ci skip] Update set output
Dreeam-qwq/Gale@d95dc9d Updated Upstream (Paper)
2024-07-18 08:39:32 +08:00

112 lines
2.9 KiB
Bash

#!/usr/bin/env bash
# requires curl & jq
# Credit: https://github.com/PurpurMC/Purpur
# Usage:
# upstreamCommit --paper HASH --gale HASH --purpur HASH --leaves HASH
# flag: --paper HASH - (Optional) the commit hash to use for comparing commits between paper (PaperMC/Paper/compare/HASH...HEAD)
# flag: --gale HASH - the commit hash to use for comparing commits between gale (Dreeam-qwq/Gale/compare/HASH...HEAD)
# flag: --purpur HASH - the commit hash to use for comparing commits between purpur (PurpurMC/Purpur/compare/HASH...HEAD)
# flag: --leaves HASH - the commit hash to use for comparing commits between leaves (LeavesMC/Leaves/compare/HASH...HEAD)
function getCommits() {
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/"$1"/compare/"$2"..."$3" | jq -r '.commits[] | "'"$1"'@\(.sha[:7]) \(.commit.message | split("\r\n")[0] | split("\n")[0])"'
}
(
set -e
PS1="$"
galeHash=$(git diff gradle.properties | awk '/^-galeCommit =/{print $NF}')
paperHash=""
purpurHash=""
leavesHash=""
TEMP=$(getopt --long paper:,gale:,purpur:,leaves: -o "" -- "$@")
eval set -- "$TEMP"
while true; do
case "$1" in
--paper)
paperHash="$2"
shift 2
;;
--gale)
galeHash="$2"
shift 2
;;
--purpur)
purpurHash="$2"
shift 2
;;
--leaves)
leavesHash="$2"
shift 2
;;
*)
break
;;
esac
done
paper=""
gale=""
purpur=""
leaves=""
updated=""
logsuffix=""
# Paper updates
if [ -n "$paperHash" ]; then
paper=$(getCommits "PaperMC/Paper" "$paperHash" "HEAD")
# Updates found
if [ -n "$paper" ]; then
updated="Paper"
logsuffix="$logsuffix\n\nPaper Changes:\n$paper"
fi
fi
# Gale updates
if [ -n "$galeHash" ]; then
newHash=$(git diff gradle.properties | awk '/^+galeCommit =/{print $NF}')
gale=$(getCommits "Dreeam-qwq/Gale" "$galeHash" $(echo $newHash | grep . -q && echo $newHash || echo "HEAD"))
# Updates found
if [ -n "$gale" ]; then
updated="${updated:+$updated/}Gale"
logsuffix="$logsuffix\n\nGale Changes:\n$gale"
fi
fi
# Purpur updates
if [ -n "$purpurHash" ]; then
purpur=$(getCommits "PurpurMC/Purpur" "$purpurHash" "HEAD")
# Updates found
if [ -n "$purpur" ]; then
updated="${updated:+$updated/}Purpur"
logsuffix="$logsuffix\n\nPurpur Changes:\n$purpur"
fi
fi
# Leaves updates
if [ -n "$leavesHash" ]; then
leaves=$(getCommits "LeavesMC/Leaves" "$leavesHash" "HEAD")
# Updates found
if [ -n "$leaves" ]; then
updated="${updated:+$updated/}Leaves"
logsuffix="$logsuffix\n\nLeaves Changes:\n$leaves"
fi
fi
disclaimer="Upstream has released updates that appear to apply and compile correctly"
log="Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}"
git add gradle.properties
echo -e "$log" | git commit -F -
) || exit 1