From 0f51699ea1ab29aa06fa683a0f1ca43d5ffcf24d Mon Sep 17 00:00:00 2001 From: Nick Vanpraet Date: Wed, 30 Oct 2024 17:11:10 +0100 Subject: [PATCH] Update delete mirror logic --- .github/scripts/mirror.sh | 18 +++++------------- .github/workflows/gitlab_mirroring.yml | 4 ++-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/scripts/mirror.sh b/.github/scripts/mirror.sh index 0b74d05a..9730ac8e 100755 --- a/.github/scripts/mirror.sh +++ b/.github/scripts/mirror.sh @@ -2,10 +2,10 @@ set -euo pipefail -echo "${GITHUB_EVENT_NAME}" -echo "${GITHUB_REF}" -echo "github.event.ref: $GH_EV_RF" -echo "github.event.ref_type: $GH_EV_RF_T" +echo "Event: ${GITHUB_EVENT_NAME}" +echo "Triggering git reference: ${GITHUB_REF}" +echo "Triggering git reference for push events: ${GH_REF}" +echo "Triggering git reference type: ${GH_REF_TYPE}" function git-setup() { @@ -35,16 +35,8 @@ elif test "$GITHUB_EVENT_NAME" == "workflow_dispatch"; then git push mirror ${GITHUB_REF}:${GITHUB_REF} --force --tags git remote remove mirror elif test "$GITHUB_EVENT_NAME" == "delete"; then - if test "$DELETED_REF_TYPE" == "tag"; then - FULL_DELETED_REF="refs/tags/$DELETED_REF" - elif test "$DELETED_REF_TYPE" == "branch"; then - FULL_DELETED_REF="refs/heads/$DELETED_REF" - else - echo "Unexpected DELETED_REF_TYPE=$DELETED_REF_TYPE, expected 'branch' or 'tag'" - exit 1 - fi git-setup - git push mirror :${FULL_DELETED_REF} + git push mirror :${GH_REF} git remote remove mirror else echo "Got unexpected GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}" diff --git a/.github/workflows/gitlab_mirroring.yml b/.github/workflows/gitlab_mirroring.yml index 23221c16..510359f4 100644 --- a/.github/workflows/gitlab_mirroring.yml +++ b/.github/workflows/gitlab_mirroring.yml @@ -16,5 +16,5 @@ jobs: GITLAB_REPOSITORY: "https://gitlab.dropsolid.com/project/mauticorg.git" GITLAB_USERNAME: ${{ github.actor }} GITLAB_TOKEN: ${{ secrets.GITLAB_MIRRORING_TOKEN }} - GH_EV_RF: ${{ github.event.ref }} - GH_EV_RF_T: ${{ github.event.ref_type }} + GH_REF: ${{ github.event.ref }} + GH_REF_TYPE: ${{ github.event.ref_type }}