mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 02:10:40 +00:00
[CI] push forgejo branches to the specified destination
(cherry picked from commit22abd100cb
) (cherry picked from commit4e2c30cb5b
) (cherry picked from commit1ddc08747c
) (cherry picked from commitba3df01314
) (cherry picked from commit644f7cb733
)
This commit is contained in:
parent
86c586941a
commit
20de330e17
1 changed files with 25 additions and 0 deletions
25
.forgejo/workflows/mirror.yml
Normal file
25
.forgejo/workflows/mirror.yml
Normal 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/*
|
Loading…
Reference in a new issue