Skip to content

Commit

Permalink
update: mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
k8scat committed Jan 6, 2022
1 parent 02b7281 commit 4891f59
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
echo "::set-output name=repo_list::${repo_list}"
- name: action-git-mirror
uses: k8scat/[email protected].24
uses: k8scat/[email protected].25
with:
source_protocol: https
source_host: github.com
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
os = $(shell uname -s)

version = 0.0.24
version = 0.0.25
image = mirror-git:$(version)

cr_user = gigrator
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ docker run \
-e INPUT_FORCE_PUSH="false" \
-e INPUT_NOTIFY_PREFIX="Mirror Git" \
-e INPUT_NOTIFY_SUFFIX="Powered by https://github.com/k8scat/action-mirror-git" \
gigrator/mirror-git:0.0.24
gigrator/mirror-git:0.0.25
```

## LICENSE
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ inputs:
default: "false"
runs:
using: "docker"
image: "docker://ghcr.io/k8scat/mirror-git:0.0.24"
image: "docker://ghcr.io/k8scat/mirror-git:0.0.25"
10 changes: 0 additions & 10 deletions mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,10 @@ function mirror() {

if [[ -n "${INPUT_DEST_CREATE_REPO_SCRIPT}" ]]; then
echo "Creating repo: ${REPO_NAME}"
set -x
if ! create_repo; then
notify "Failed to create repo: ${REPO_NAME}"
return 1
fi
set +x
fi

repo_dir="${WORKDIR}/${REPO_NAME}"
Expand All @@ -217,20 +215,16 @@ function mirror() {
notify "Failed to push ${REPO_NAME} to ${dest_addr} with --all flag"
if [[ "${INPUT_FORCE_PUSH}" = "true" && -n "${INPUT_DEST_DELETE_REPO_SCRIPT}" && -n "${INPUT_DEST_CREATE_REPO_SCRIPT}" ]]; then
echo "Deleting repo: ${REPO_NAME}"
set -x
if ! delete_repo; then
notify "Failed to delete repo: ${REPO_NAME}"
return 1
fi
set +x

echo "Creating repo: ${REPO_NAME}"
set -x
if ! create_repo; then
notify "Failed to create repo: ${REPO_NAME}"
return 1
fi
set +x

if ! git push --all -f "${dest_addr}"; then
notify "Still failed to push ${REPO_NAME} to ${dest_addr} with --all flag"
Expand All @@ -243,20 +237,16 @@ function mirror() {
notify "Failed to push ${REPO_NAME} to ${dest_addr} with --mirror flag"
if [[ "${INPUT_FORCE_PUSH}" = "true" && -n "${INPUT_DEST_DELETE_REPO_SCRIPT}" && -n "${INPUT_DEST_CREATE_REPO_SCRIPT}" ]]; then
echo "Deleting repo: ${REPO_NAME}"
set -x
if ! delete_repo; then
notify "Failed to delete repo: ${REPO_NAME}"
return 1
fi
set +x

echo "Creating repo: ${REPO_NAME}"
set -x
if ! create_repo; then
notify "Failed to create repo: ${REPO_NAME}"
return 1
fi
set +x

if ! git push --mirror -f "${dest_addr}"; then
notify "Still failed to push ${REPO_NAME} to ${dest_addr} with --mirror flag"
Expand Down

0 comments on commit 4891f59

Please sign in to comment.