Sync Git Repo #310
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Git Repo | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 3 * * *' | |
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/DiamondHunters/NodeInject.git' | |
- 'https://github.com/DiamondHunters/NodeInject_Hook_example.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' | |
# 500 Errors in recently days | |
# - '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://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/3Kmfi6HP/EDtunnel.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' | |
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) | |
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/$REPO_NAME.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 |