From 3b770d8c47ae6b3531231e8f3e5c52abcbca575e Mon Sep 17 00:00:00 2001 From: yasaichi Date: Tue, 15 Nov 2022 15:55:47 +0900 Subject: [PATCH 1/2] Remove remote branches after repository mirroring closes #17, #18 --- Dockerfile | 3 ++- cleanup.sh | 4 ++++ mirror.sh | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 cleanup.sh 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 From 68205a00e29479b6662bc7e250944ecd06db4d8f Mon Sep 17 00:00:00 2001 From: yasaichi Date: Tue, 15 Nov 2022 16:14:04 +0900 Subject: [PATCH 2/2] Don't run tests 2 times in pull requests --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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