diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2544502..3b67272 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,11 @@ name: Test on: delete: - push: pull_request: + push: branches: - main + jobs: check_preconditions: runs-on: ubuntu-latest diff --git a/Dockerfile b/Dockerfile index 622cca1..7240ce8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ RUN apk update && apk upgrade && \ RUN git lfs install -COPY mirror.sh /mirror.sh COPY setup-ssh.sh /setup-ssh.sh +COPY mirror.sh /mirror.sh +COPY cleanup.sh /cleanup.sh ENTRYPOINT ["/mirror.sh"] diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 0000000..86c5200 --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +set -eu + +git remote remove "$1" diff --git a/mirror.sh b/mirror.sh index 67ea71f..61db2e3 100755 --- a/mirror.sh +++ b/mirror.sh @@ -6,3 +6,7 @@ set -eu export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -l $INPUT_SSH_USERNAME" git remote add mirror "$INPUT_TARGET_REPO_URL" git push --tags --force --prune mirror "refs/remotes/origin/*:refs/heads/*" + +# NOTE: Since `post` execution is not supported for local action from './' for now, we need to +# run the command by hand. +/cleanup.sh mirror