Skip to content

Sync Git Repo

Sync Git Repo #513

Workflow file for this run

name: Sync Git Repo
on:
push:
workflow_dispatch:
schedule:
- cron: '30 19 */2 * *'
jobs:
sync:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
REPO_URL:
# Already dead repo
# - 'https://github.com/lvguanjun/copilot_share.git'
# - 'https://github.com/pandora-next/deploy.git'
# - 'https://github.com/3Kmfi6HP/EDtunnel.git'
# - 'https://github.com/DiamondHunters/NodeInject_Hook_example.git'
- 'https://github.com/DiamondHunters/NodeInject.git'
- 'https://github.com/tornadocash/tornado-core.git'
- 'https://github.com/tornadocash/tornado-cli.git'
- 'https://github.com/tornadocash/ui-minified.git'
- 'https://github.com/tornadocash/tornado-relayer.git'
- 'https://github.com/tornadocash/tornado-anonymity-mining.git'
- 'https://github.com/tornadocash/torn-token.git'
- 'https://git.unlock-music.dev/um/web.git'
- 'https://git.unlock-music.dev/um/cli.git'
- 'https://git.unlock-music.dev/um/um-react.git'
- 'https://git.unlock-music.dev/um/go-mmkv.git'
- 'https://git.unlock-music.dev/um/um-react-wry.git'
- 'https://git.unlock-music.dev/um/kgg-dec.git'
- 'https://git.unlock-music.dev/um/lib_um_crypto_rust.git'
- 'https://git.unlock-music.dev/um/joox-crypto.git'
- 'https://github.com/spencerwooo/onedrive-vercel-index.git'
- 'https://github.com/2dust/v2rayN.git'
- 'https://github.com/2dust/v2rayNG.git'
- 'https://github.com/2dust/clashN.git'
- 'https://github.com/v2ray/v2ray-core.git'
- 'https://github.com/macronut/phantomsocks.git'
- 'https://github.com/macronut/ghostcp.git'
- 'https://github.com/macronut/godivert.git'
- 'https://github.com/macronut/magisk-module-phantomsocks.git'
- 'https://github.com/zizifn/edgetunnel.git'
- 'https://github.com/Grasscutters/Grasscutter.git'
- 'https://github.com/LSPosed/MagiskOnWSALocal.git'
- 'https://github.com/iperov/DeepFaceLab.git'
- 'https://github.com/deepfakes/faceswap.git'
- 'https://github.com/SeaHOH/GotoX.git'
- 'https://github.com/moesnow/March7thAssistant.git'
- 'https://github.com/x-dr/telegraph-Image.git'
- 'https://github.com/SpaceTimee/Bot-CealingCat.git'
- 'https://github.com/SpaceTimee/Cealing-Host.git'
- 'https://github.com/SpaceTimee/Console-HostGenerator.git'
- 'https://github.com/SpaceTimee/Ona-Dop.git'
- 'https://github.com/SpaceTimee/Ona-Pix.git'
- 'https://github.com/SpaceTimee/Ona-Prox.git'
- 'https://github.com/SpaceTimee/Sheas-Cealer.git'
- 'https://github.com/SpaceTimee/Sheas-Dop.git'
- 'https://github.com/SpaceTimee/Sheas-Nginx.git'
- 'https://github.com/SpotX-Official/SpotX.git'
- 'https://github.com/SpotX-Official/SpotX-Bash.git'
- 'https://github.com/ikunshare/Onekey.git'
- 'https://github.com/guozhigq/pilipala.git'
include:
- REPO_URL: 'https://git.unlock-music.dev/um/web.git'
GITLAB_REPO: 'web_v2'
- REPO_URL: 'https://git.unlock-music.dev/um/lib_um_crypto_rust.git'
GITLAB_REPO: 'lib_um_crypto_rust_v2'
- REPO_URL: 'https://github.com/SpaceTimee/Cealing-Host.git'
GITLAB_REPO: 'Cealing-Host_v5'
- REPO_URL: 'https://github.com/SpaceTimee/Sheas-Cealer.git'
GITLAB_REPO: 'Sheas-Cealer_v2'
steps:
- name: Clone git repository
run: |
git clone --mirror ${{ matrix.REPO_URL }}
- name: Push to remote
env:
GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }}
GITLAB_USERMAIL: ${{ secrets.GITLAB_USERMAIL }}
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
run: |
export REPO_NAME=$(basename "${{ matrix.REPO_URL }}" .git)
export GITLAB_REPO=${{ matrix.GITLAB_REPO }}
# IF GITLAB_REPO is not given, use default path
if [ -z "$GITLAB_REPO" ]; then
GITLAB_REPO="$REPO_NAME"
fi
cd $REPO_NAME.git
git config user.name $GITLAB_USERNAME
git config user.email $GITLAB_USERMAIL
git remote add gitlab https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.com/mirrors_git/$GITLAB_REPO.git
git push gitlab --all
visiable:
needs: sync
if: always()
runs-on: ubuntu-latest
steps:
- name: Change Project Visiable
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
TOKEN="$GITLAB_TOKEN"
GITLAB_URL="https://gitlab.com"
GROUP_ID="77318098"
# Get the ID of all Projects in the Group
project_ids=$(curl --header "PRIVATE-TOKEN: $TOKEN" "$GITLAB_URL/api/v4/groups/$GROUP_ID/projects" | jq '.[].id')
for id in $project_ids
do
curl --request PUT --header "PRIVATE-TOKEN: $TOKEN" "$GITLAB_URL/api/v4/projects/$id?visibility=public"
done
clean:
needs: sync
if: always()
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 6