fix(dual-approval): replace echo with printf to avoid jq parse errors (PRI-1757)
This commit is contained in:
committed by
Gandalf the Greybeard [agent]
parent
6c04ca39a2
commit
75e6295492
@@ -91,14 +91,14 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
REVIEWER_APPROVED=$(echo "${REVIEWS}" | jq -r --arg user "${REQUIRED_REVIEWER}" \
|
REVIEWER_APPROVED=$(printf '%s' "${REVIEWS}" | jq -r --arg user "${REQUIRED_REVIEWER}" \
|
||||||
'[.[] | select(.user.login == $user)] | last | if .state then .state == "APPROVED" else false end')
|
'[.[] | select(.user.login == $user)] | last | if .state then .state == "APPROVED" else false end')
|
||||||
|
|
||||||
echo "${GATE_NAME} (${REQUIRED_REVIEWER}) approved: ${REVIEWER_APPROVED}"
|
echo "${GATE_NAME} (${REQUIRED_REVIEWER}) approved: ${REVIEWER_APPROVED}"
|
||||||
|
|
||||||
# Fallback: check if CTO approved as alternative for uat→main
|
# Fallback: check if CTO approved as alternative for uat→main
|
||||||
if [ "${REVIEWER_APPROVED}" != "true" ] && [ -n "${ALT_REVIEWER}" ]; then
|
if [ "${REVIEWER_APPROVED}" != "true" ] && [ -n "${ALT_REVIEWER}" ]; then
|
||||||
REVIEWER_APPROVED=$(echo "${REVIEWS}" | jq -r --arg user "${ALT_REVIEWER}" \
|
REVIEWER_APPROVED=$(printf '%s' "${REVIEWS}" | jq -r --arg user "${ALT_REVIEWER}" \
|
||||||
'[.[] | select(.user.login == $user)] | last | if .state then .state == "APPROVED" else false end')
|
'[.[] | select(.user.login == $user)] | last | if .state then .state == "APPROVED" else false end')
|
||||||
if [ "${REVIEWER_APPROVED}" = "true" ]; then
|
if [ "${REVIEWER_APPROVED}" = "true" ]; then
|
||||||
echo "CTO (${ALT_REVIEWER}) approved as fallback for UAT gate."
|
echo "CTO (${ALT_REVIEWER}) approved as fallback for UAT gate."
|
||||||
|
|||||||
Reference in New Issue
Block a user