Skip to content

Commit

Permalink
Merge pull request #20 from pixta-dev/remove-remote-branches
Browse files Browse the repository at this point in the history
Remove remote branches after repository mirroring
  • Loading branch information
yasaichi authored Nov 15, 2022
2 parents b25339a + 68205a0 commit 674e65a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Test
on:
delete:
push:
pull_request:
push:
branches:
- main

jobs:
check_preconditions:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 4 additions & 0 deletions cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
set -eu

git remote remove "$1"
4 changes: 4 additions & 0 deletions mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 674e65a

Please sign in to comment.