Merge pull request #19 from popcornmix/branch_hash

rpi-update: Extract git hash from artifact build from branch
This commit is contained in:
popcornmix
2023-10-10 11:18:43 +01:00
committed by GitHub

View File

@@ -692,11 +692,13 @@ if [[ "${FW_REV}" == "" ]]; then
if [[ ${FW_REV_IN} != http* ]] && [[ ! -f ${FW_REV_IN} ]]; then
IFS=':' read ARTIFACT BUILD <<<${FW_REV_IN}
if [[ "${BUILD}" == "" ]]; then
BUILD="bcmrpi bcm2709 bcm2711 bcm2711_arm64"
BUILD="bcmrpi bcm2709 bcm2711 bcm2711_arm64 bcm2712"
fi
if [[ "${ARTIFACT}" == pulls/* ]]; then
PULL=${ARTIFACT##*/}
ARTIFACT=$(eval curl -s "https://api.github.com/repos/raspberrypi/linux/pulls/${PULL}" | awk '/"sha":/ {gsub(/"/, "", $2); gsub(/,/, "", $2); print $2; exit}')
else
ARTIFACT=$(eval curl -s "https://api.github.com/repos/raspberrypi/linux/actions/artifacts" | grep -A1 "\"head_branch\": \"${FW_REV_IN}\"" | awk '/"head_sha":/ {gsub(/"/, "", $2); gsub(/,/, "", $2); print $2; exit}')
fi
else
ARTIFACT=${FW_REV_IN}