mirror of
https://github.com/terraphim/gitea-infrastructure.git
synced 2026-07-16 01:00:33 +02:00
docs: Add repository mirroring guide and GitHub Actions
- Complete mirroring guide (GitHub ↔ Gitea) - GitHub Actions workflow to sync to Gitea - Mirror status check workflow - SSH and token authentication methods - Troubleshooting guide
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
name: Mirror Status Check
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 */6 * * *' # Every 6 hours
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check-sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if repositories are in sync
|
||||
run: |
|
||||
# Get latest commit from GitHub
|
||||
GITHUB_SHA=$(curl -s \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/terraphim/gitea-infrastructure/commits/main" | \
|
||||
jq -r '.sha')
|
||||
|
||||
# Get latest commit from Gitea
|
||||
GITEA_SHA=$(curl -s \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"https://git.terraphim.cloud/api/v1/repos/terraphim/gitea-infrastructure/commits/main" | \
|
||||
jq -r '.sha')
|
||||
|
||||
echo "GitHub: ${GITHUB_SHA:0:7}"
|
||||
echo "Gitea: ${GITEA_SHA:0:7}"
|
||||
|
||||
if [ "$GITHUB_SHA" == "$GITEA_SHA" ]; then
|
||||
echo "✅ Repositories are in sync"
|
||||
exit 0
|
||||
else
|
||||
echo "⚠️ Repositories are OUT OF SYNC"
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Sync to Gitea
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Full history
|
||||
|
||||
- name: Push to Gitea
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
git remote add gitea https://git.terraphim.cloud/terraphim/gitea-infrastructure.git
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "actions@github.com"
|
||||
|
||||
# Push to Gitea with token authentication
|
||||
# If using HTTPS with token: https://token@url
|
||||
git push https://oauth2:${GITEA_TOKEN}@git.terraphim.cloud/terraphim/gitea-infrastructure.git main
|
||||
Reference in New Issue
Block a user