forgejo: replace with mirror-repository.yml
This commit is contained in:
parent
d49046ec82
commit
3a7608b1ed
2 changed files with 37 additions and 0 deletions
37
.forgejo/workflows/mirror-repository.yml
Normal file
37
.forgejo/workflows/mirror-repository.yml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
schedule:
|
||||||
|
- cron: '@hourly'
|
||||||
|
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mirror:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: 'docker.io/node:20-bookworm'
|
||||||
|
steps:
|
||||||
|
- name: git mirror branches {v*/,}main & tags
|
||||||
|
run: |
|
||||||
|
git init --bare .
|
||||||
|
git remote add origin https://github.com/zotero/zotero.git
|
||||||
|
git fetch origin refs/heads/main:refs/mirror/main
|
||||||
|
git ls-remote origin refs/heads/v*/main | while read sha full_ref ; do
|
||||||
|
ref=${full_ref#refs/heads/}
|
||||||
|
git fetch origin $full_ref:refs/mirror/$ref
|
||||||
|
tag=${ref%/main}
|
||||||
|
git fetch origin refs/tags/${tag}*:refs/mirror-tags/${tag}*
|
||||||
|
done
|
||||||
|
if test "${{ vars.TEST }}" != true ; then
|
||||||
|
token=${{ secrets.CODE_FORGEJO_TOKEN }}
|
||||||
|
destination=${{ vars.DESTINATION }}
|
||||||
|
owner=${{ vars.OWNER }}
|
||||||
|
else
|
||||||
|
token=${{ secrets.TEST_FORGEJO_TOKEN }}
|
||||||
|
destination=${{ vars.TEST_DESTINATION }}
|
||||||
|
owner=${{ vars.TEST_OWNER }}
|
||||||
|
fi
|
||||||
|
git push --force https://any:$token@$destination/$owner/zotero refs/mirror/*:refs/heads/* refs/mirror-tags/*:refs/tags/*
|
Loading…
Reference in a new issue