Skip to content

Commit

Permalink
Update delete mirror logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-vanpraet committed Oct 30, 2024
1 parent 264689d commit 0f51699
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
18 changes: 5 additions & 13 deletions .github/scripts/mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gitlab_mirroring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 0f51699

Please sign in to comment.