Skip to content

Commit

Permalink
2024-08-20 21:14:13
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiKimera committed Aug 20, 2024
1 parent 4b63311 commit 137df47
Showing 1 changed file with 3 additions and 41 deletions.
44 changes: 3 additions & 41 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
jobs:

# ------------------------------------------------------------------------------------------------------------------ #
# GitLab.
# GITLAB
# ------------------------------------------------------------------------------------------------------------------ #

mirror_gitlab:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
dst_token: '${{ secrets.BOT_MIRROR_TOKEN_GITLAB }}'

# ------------------------------------------------------------------------------------------------------------------ #
# Codeberg.
# CODEBERG
# ------------------------------------------------------------------------------------------------------------------ #

mirror_codeberg:
Expand Down Expand Up @@ -86,45 +86,7 @@ jobs:
dst_token: '${{ secrets.BOT_MIRROR_TOKEN_CODEBERG }}'

# ------------------------------------------------------------------------------------------------------------------ #
# MosHub.
# ------------------------------------------------------------------------------------------------------------------ #

mirror_moshub:
runs-on: ubuntu-latest
name: 'MosHub'
env:
DOMAIN: 'https://hub.mos.ru'
VERSION: 'v4'
NSID: '38795'
steps:
- name: 'Get repository name'
shell: bash
run: |
echo "REPO_NAME=$( echo '${{ github.repository }}' | awk -F '/' '{ print $2 }' )" >> $GITHUB_ENV
- name: 'Create repository'
shell: bash
run: |
http="$( curl -s -o '/dev/null' -I -w '%{http_code}' -A '${{ env.USER_AGENT }}' '${{ env.DOMAIN }}/${{ env.OWNER }}/${{ env.REPO_NAME }}' )"
if [[ "${http}" -ne 200 ]]; then
curl -X POST \
-H 'Authorization: Bearer ${{ secrets.BOT_MIRROR_TOKEN_MOSHUB }}' \
-H 'Content-Type: application/json' \
-A '${{ env.USER_AGENT }}' \
'${{ env.DOMAIN }}/api/${{ env.VERSION }}/projects/' \
-d '{"name":"${{ env.REPO_NAME }}","path":"${{ env.REPO_NAME }}","namespace_id":"${{ env.NSID }}","visibility":"public"}'
fi
- name: 'Mirror repository'
uses: ghastore/github-mirror@main
with:
src_repo: '${{ github.server_url }}/${{ github.repository }}.git'
src_user: '${{ secrets.BOT_MIRROR_NAME }}'
src_token: '${{ secrets.BOT_MIRROR_TOKEN_GITHUB }}'
dst_repo: '${{ env.DOMAIN }}/${{ env.OWNER }}/${{ env.REPO_NAME }}.git'
dst_user: '${{ secrets.BOT_MIRROR_NAME }}'
dst_token: '${{ secrets.BOT_MIRROR_TOKEN_MOSHUB }}'

# ------------------------------------------------------------------------------------------------------------------ #
# Disroot.
# DISROOT
# ------------------------------------------------------------------------------------------------------------------ #

mirror_disroot:
Expand Down

0 comments on commit 137df47

Please sign in to comment.