2024-01-04 16:48:46 +00:00
|
|
|
name: mirror
|
|
|
|
|
|
|
|
on:
|
2024-02-17 10:55:52 +00:00
|
|
|
schedule:
|
|
|
|
- cron: '@daily'
|
2024-01-04 16:48:46 +00:00
|
|
|
|
|
|
|
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/}
|
2024-01-15 19:01:28 +00:00
|
|
|
echo git fetch origin $full_ref:refs/mirror/$ref
|
2024-01-04 16:48:46 +00:00
|
|
|
git fetch origin $full_ref:refs/mirror/$ref
|
|
|
|
done
|
2024-01-15 19:01:28 +00:00
|
|
|
echo git push --force https://${{ vars.MIRROR_DESTINATION }} refs/mirror/*:refs/heads/*
|
2024-01-04 16:48:46 +00:00
|
|
|
git push --force https://any:${{ secrets.MIRROR_TOKEN }}@${{ vars.MIRROR_DESTINATION }} refs/mirror/*:refs/heads/*
|