keycloak/.github/scripts/version-compatibility.sh
Pedro Ruivo fcdc03a2f6
Fix mixed-cluster-compatibility-tests version matrix
Fixes #45708

Signed-off-by: Pedro Ruivo <1492066+pruivo@users.noreply.github.com>
Co-authored-by: Pedro Ruivo <1492066+pruivo@users.noreply.github.com>
2026-01-23 15:07:48 +00:00

30 lines
650 B
Bash
Executable file

#!/bin/bash -e
if [[ "$RUNNER_DEBUG" == "1" ]]; then
set -x
fi
TARGET_BRANCH="$1"
REPO="${2:-keycloak}"
ORG="${3:-keycloak}"
if [[ "${TARGET_BRANCH}" != "release/"* ]]; then
echo "skip"
exit 0
fi
ALL_RELEASES=$(gh release list \
--repo "${ORG}/${REPO}" \
--exclude-drafts \
--exclude-pre-releases \
--json name \
--template '{{range .}}{{.name}}{{"\n"}}{{end}}'
)
MAJOR_MINOR=${TARGET_BRANCH#"release/"}
MAJOR_MINOR_RELEASES=$(echo "${ALL_RELEASES}" | (grep "${MAJOR_MINOR}" || true))
if [[ -z "${MAJOR_MINOR_RELEASES}" ]]; then
echo "skip"
else
echo -n "${MAJOR_MINOR_RELEASES}" | jq -cnMR '[inputs] | map({version: .})'
fi