mirror of https://sc.cryxtal.org/crystal/forgejo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
913 B
26 lines
913 B
name: mirror
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '@daily'
|
|
|
|
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/}
|
|
echo git fetch origin $full_ref:refs/mirror/$ref
|
|
git fetch origin $full_ref:refs/mirror/$ref
|
|
done
|
|
echo git push --force https://${{ vars.MIRROR_DESTINATION }} refs/mirror/*:refs/heads/*
|
|
git push --force https://any:${{ secrets.MIRROR_TOKEN }}@${{ vars.MIRROR_DESTINATION }} refs/mirror/*:refs/heads/*
|