mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
ci: Push to mirror repo with github actions
This commit is contained in:
parent
cd978388b2
commit
0406160452
1 changed files with 47 additions and 0 deletions
47
.github/workflows/mirror.yml
vendored
Normal file
47
.github/workflows/mirror.yml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
# REF: https://github.com/JamesRobionyRogers/GitHub-to-GitBucket-Action/blob/47a44e9/.github/workflows/push-to-gitbucket.yml
|
||||
name: Mirror Repository
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
mirror:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Fetch all branches
|
||||
run: |
|
||||
git fetch --all
|
||||
git fetch --tags
|
||||
|
||||
- name: List branches
|
||||
run: |
|
||||
git branch -a
|
||||
|
||||
# Enables tracking of remote branches ensuring all branches are pushed to mirror repo
|
||||
- name: Track remote branches
|
||||
run: |
|
||||
for branch in $(git branch -r | grep -v '\->'); do
|
||||
local_branch=${branch#origin/}
|
||||
git branch --track "$local_branch" "$branch" || true
|
||||
done
|
||||
|
||||
- name: Push to mirror repo (GitLab)
|
||||
env:
|
||||
MIRROR_URL: "gitlab.com/null2264/yokai.git"
|
||||
MIRROR_USERNAME: ${{ secrets.MIRROR_USERNAME }}
|
||||
MIRROR_AUTH: ${{ secrets.MIRROR_AUTH }}
|
||||
run: |
|
||||
git config --global user.name "GitHub Actions"
|
||||
git config --global user.email "actions@github.com"
|
||||
|
||||
git remote add mirror https://$MIRROR_USERNAME:$MIRROR_AUTH@$MIRROR_URL
|
||||
git push --mirror -v mirror
|
Loading…
Add table
Add a link
Reference in a new issue