summaryrefslogtreecommitdiffstats
path: root/.forgejo/workflows/mirror.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-10-18 20:33:49 +0200
committerDaniel Baumann <daniel@debian.org>2024-12-12 23:57:56 +0100
commite68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch)
tree97775d6c13b0f416af55314eb6a89ef792474615 /.forgejo/workflows/mirror.yml
parentInitial commit. (diff)
downloadforgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz
forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to '.forgejo/workflows/mirror.yml')
-rw-r--r--.forgejo/workflows/mirror.yml27
1 files changed, 27 insertions, 0 deletions
diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml
new file mode 100644
index 0000000..fd22211
--- /dev/null
+++ b/.forgejo/workflows/mirror.yml
@@ -0,0 +1,27 @@
+name: mirror
+
+on:
+ workflow_dispatch:
+
+ schedule:
+ - cron: '@daily'
+
+jobs:
+ mirror:
+ if: ${{ secrets.MIRROR_TOKEN != '' }}
+ runs-on: docker
+ container:
+ image: 'code.forgejo.org/oci/node:20-bookworm'
+ steps:
+ - name: git push {v*/,}forgejo
+ run: |
+ git init --bare .
+ git remote add origin ${{ env.GITHUB_SERVER_URL }}/${{ env.GITHUB_REPOSITORY }}
+ git fetch origin refs/heads/forgejo:refs/mirror/forgejo
+ git ls-remote origin refs/heads/v*/forgejo | while read sha full_ref ; do
+ ref=${full_ref#refs/heads/}
+ echo git fetch origin $full_ref:refs/mirror/$ref
+ git fetch origin $full_ref:refs/mirror/$ref
+ done
+ echo git push --force https://${{ vars.MIRROR_DESTINATION }} refs/mirror/*:refs/heads/*
+ git push --force https://any:${{ secrets.MIRROR_TOKEN }}@${{ vars.MIRROR_DESTINATION }} refs/mirror/*:refs/heads/*