diff --git a/.github/actions/install-crucible/install-crucible.sh b/.github/actions/install-crucible/install-crucible.sh index ef7d0f7..cb76c85 100755 --- a/.github/actions/install-crucible/install-crucible.sh +++ b/.github/actions/install-crucible/install-crucible.sh @@ -184,6 +184,24 @@ if [ "${CI_TARGET}" != "none" -a "${CI_TARGET_DIR}" != "none" ]; then rm -v $(basename ${STALE_LINK}) echo "Creating new symbolic link:" ln -sv ${CI_TARGET_DIR} $(basename ${STALE_LINK}) + popd > /dev/null + + if push ${STALE_LINK} > /dev/null; then + REPO_FILE="/opt/crucible/config/repos.json" + echo "Setting primary-branch and checkout.target for ${CI_TARGET} to 'HEAD' in ${REPO_FILE}" + source /opt/crucible/bin/jqlib + function exit_error() { + echo "ERROR: ${1}" + exit 1 + } + jq_update ${REPO_FILE} ${CI_TARGET}:primary-branch --arg repository "$CI_TARGET}" --arg primary_branch "HEAD" '(.official[] | select(.name == $repository) | ."primary-branch") |= $primary_branch' + jq_update ${REPO_FILE} ${CI_TARGET}:checkout.target --arg repository "$CI_TARGET}" --arg checkout_target "HEAD" '(.official[] | select(.name == $repository) | .checkout.target) |= $checkout_target' + + popd > /dev/null + else + echo "ERROR: Could not pushd to ${STALE_LINK}" + exit 1 + fi else echo "ERROR: Could not pushd to $(dirname ${STALE_LINK})" exit 1