From 2cb7ae9838f59bffef9f788c9a51ef68885ad650 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Fri, 31 May 2024 10:38:26 +0200 Subject: [PATCH] chore: mirror branches and tags to codeberg.org --- .forgejo/workflows/mirror.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .forgejo/workflows/mirror.yml diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml new file mode 100644 index 0000000..8f7ebee --- /dev/null +++ b/.forgejo/workflows/mirror.yml @@ -0,0 +1,24 @@ +on: + schedule: + - cron: '@hourly' + + push: + branches: + - 'main' + +jobs: + mirror: + runs-on: docker + steps: + - name: git mirror branches {main,maint/*] & tags + run: | + git init --bare . + git remote add origin https://code.forgejo.org/${{ env.GITHUB_REPOSITORY }} + git fetch origin refs/heads/main:refs/mirror/main --tags + git ls-remote origin refs/heads/main/* | while read sha full_ref ; do + ref=${full_ref#refs/heads/} + git fetch origin $full_ref:refs/mirror/$ref + done + git push --force https://any:$CODEBERG_TOKEN@codeberg.org/${{ env.GITHUB_REPOSITORY }} refs/mirror/*:refs/heads/* --tags + env: + CODEBERG_TOKEN: ${{secrets.CODEBERG_TOKEN}}