Added mirror repo to cnb.cool. (#7108)

This commit is contained in:
李铭昕 2024-10-09 10:01:56 +08:00 committed by GitHub
parent 89a8f45fab
commit 6a4f612572
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

20
.github/workflows/cnb.yml vendored Normal file
View File

@ -0,0 +1,20 @@
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