Files
vpn-configs-for-russia/.github/workflows/mirror-to-gitea.yml
Igor Krauch ff544a628b Зеркало / Mirror to Gitea
Создание зеркала на Gitea.com
Create a mirror on Gitea.com
2026-06-26 10:04:21 -04:00

54 lines
1.2 KiB
YAML

name: Mirror to Gitea
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: mirror-to-gitea
cancel-in-progress: false
permissions:
contents: read
jobs:
mirror:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout GitHub repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Push main branch to Gitea
env:
GITEA_TOKEN: ${{ secrets.GITEA_MIRROR_TOKEN }}
run: |
set -euo pipefail
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git remote remove gitea 2>/dev/null || true
git remote add gitea "https://igareck:${GITEA_TOKEN}@gitea.com/igareck/vpn-configs-for-russia.git"
for attempt in 1 2 3 4 5; do
echo "Gitea push attempt $attempt/5"
if git push gitea HEAD:main --force; then
echo "Gitea push successful"
exit 0
fi
sleep_time=$((attempt * 45))
echo "Gitea push failed. Sleeping ${sleep_time}s before retry..."
sleep "$sleep_time"
done
echo "Gitea push failed after all retries"
exit 1