Skip to content

Commit fb43049

Browse files
Create mirror-to-gitverse.yml
1 parent de26815 commit fb43049

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Mirror to GitVerse
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
tags: ["**"]
7+
delete:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: gitverse-mirror-${{ github.repository }}
15+
cancel-in-progress: false
16+
17+
jobs:
18+
mirror:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Mirror branches + tags to GitVerse
22+
env:
23+
GH_REPO: ${{ github.repository }} # org/repo
24+
GH_TOKEN: ${{ github.token }} # встроенный токен GitHub Actions
25+
GV_TOKEN: ${{ secrets.GH_SYNC }} # <-- ваш секрет (токен GitVerse)
26+
run: |
27+
set -euo pipefail
28+
29+
if [[ -z "${GV_TOKEN:-}" ]]; then
30+
echo "ERROR: missing secret GH_SYNC"
31+
exit 1
32+
fi
33+
34+
SRC="https://x-access-token:${GH_TOKEN}@github.com/${GH_REPO}.git"
35+
DST="https://${GV_TOKEN}@gitverse.ru/${GH_REPO}.git"
36+
37+
git init --bare repo.git
38+
cd repo.git
39+
40+
git remote add origin "$SRC"
41+
42+
# Забираем только ветки и теги (без служебных refs), с прунингом удалений
43+
git fetch --prune --prune-tags origin \
44+
"+refs/heads/*:refs/heads/*" \
45+
"+refs/tags/*:refs/tags/*"
46+
47+
git remote add gitverse "$DST"
48+
49+
# Пушим только ветки и теги, удалённые в GitHub — удаляем и на GitVerse
50+
git push --prune gitverse \
51+
"+refs/heads/*:refs/heads/*" \
52+
"+refs/tags/*:refs/tags/*"

0 commit comments

Comments
 (0)