1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-25 13:19:37 -05:00

[CI] push forgejo branches to the specified destination

This commit is contained in:
Earl Warren 2024-01-04 17:48:46 +01:00
parent f9da193055
commit 22abd100cb
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -0,0 +1,25 @@
name: mirror
on:
push:
branches:
- 'forgejo'
- 'v*/forgejo'
jobs:
mirror:
if: ${{ secrets.MIRROR_TOKEN != '' }}
runs-on: docker
container:
image: 'docker.io/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/}
git fetch origin $full_ref:refs/mirror/$ref
done
git push --force https://any:${{ secrets.MIRROR_TOKEN }}@${{ vars.MIRROR_DESTINATION }} refs/mirror/*:refs/heads/*