hyperf/.github/workflows/cnb.yml
2024-10-14 20:27:18 +08:00

22 lines
817 B
YAML

name: Mirror to CNB Repo
on: [ push, delete, create ]
jobs:
git-mirror:
if: github.repository == 'hyperf/hyperf'
runs-on: ubuntu-latest
steps:
- name: Push Mirror
if: github.repository_owner == 'hyperf'
env:
SOURCE_REPO: 'https://github.com/hyperf/hyperf.git'
DESTINATION_REPO: 'https://cnb:${{ secrets.CNB_TOKEN }}@cnb.cool/hyperf/hyperf.git'
run: |
git clone --mirror "$SOURCE_REPO" && cd `basename "$SOURCE_REPO"`
# git remote set-url --push origin "$DESTINATION_REPO"
# git fetch -p origin
# git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin
# git push --mirror
git push -f --prune "$DESTINATION_REPO" "refs/heads/*:refs/heads/*" "refs/tags/*:refs/tags/*"