Skip to content

Commit 5a74813

Browse files
committed
feat: add auto mirror to gitee
1 parent 2b12a0b commit 5a74813

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Mirror this repo to Gitee
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- "*"
8+
9+
jobs:
10+
mirror:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Mirror repo to Gitee
18+
id: mirror-to-gitee
19+
shell: bash
20+
env:
21+
INPUT_SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_GITEE_MIRROR }}
22+
INPUT_TARGET_REPO_URL: [email protected]:MayuriNFC/nix-config.git
23+
run: |
24+
set -eu
25+
26+
mkdir -p ~/.ssh
27+
echo "$INPUT_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
28+
chmod 600 ~/.ssh/id_rsa
29+
30+
export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no"
31+
git remote add mirror "$INPUT_TARGET_REPO_URL"
32+
git push --tags --force --prune mirror "refs/remotes/origin/*:refs/heads/*"

0 commit comments

Comments
 (0)