refactor: Replace GitHub Actions mirroring with Gitea native pull mirror

- Remove sync-to-gitea.yml and mirror-check.yml GitHub Actions workflows
- Set up Gitea as pull mirror from GitHub (1h interval, via POST /repos/migrate)
- Rewrite MIRRORING-GUIDE.md with pull mirror setup and gotchas
- Update HANDOVER.md and lessons-learned.md with new approach

Gitea now automatically pulls from GitHub. No Actions, no dual-push,
no billing dependency. Push to GitHub only; Gitea syncs within 1 hour.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 15:24:37 +01:00
parent a98941d74d
commit 1c8ab5939e
5 changed files with 253 additions and 511 deletions
+73 -18
View File
@@ -199,9 +199,64 @@ To update Gitea to a new version:
docker compose up -d --build
```
## GitHub Mirroring
## GitHub -> Gitea Mirroring
See `MIRRORING-GUIDE.md` for bidirectional GitHub ↔ Gitea mirroring setup.
Gitea is configured as a **pull mirror** from GitHub. No GitHub Actions or manual push needed.
**How it works:** Gitea polls GitHub every hour and pulls new commits automatically.
| Setting | Value |
|---------|-------|
| Source | https://github.com/terraphim/gitea-infrastructure (private) |
| Mirror | https://git.terraphim.cloud/terraphim/gitea-infrastructure |
| Interval | 1 hour |
| Auth | GitHub token stored in Gitea migration config |
### Manual Sync
```bash
source ~/op_zesticai_non_prod.sh
export GITEA_TOKEN=$(op read "op://TerraphimPlatform/git.terraphim.cloud-admin-token/credential")
curl -s -X POST "https://git.terraphim.cloud/api/v1/repos/terraphim/gitea-infrastructure/mirror-sync" \
-H "Authorization: token $GITEA_TOKEN"
```
### Recreating the Mirror
If the mirror breaks (e.g., GitHub token expires), delete and recreate:
```bash
source ~/op_zesticai_non_prod.sh
GITEA_TOKEN=$(op read "op://TerraphimPlatform/git.terraphim.cloud-admin-token/credential")
GH_TOKEN=$(gh auth token)
# Delete existing
curl -s -X DELETE "https://git.terraphim.cloud/api/v1/repos/terraphim/gitea-infrastructure" \
-H "Authorization: token $GITEA_TOKEN"
sleep 10
# Recreate as pull mirror
curl -s -X POST "https://git.terraphim.cloud/api/v1/repos/migrate" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"clone_addr\": \"https://github.com/terraphim/gitea-infrastructure\",
\"repo_name\": \"gitea-infrastructure\",
\"repo_owner\": \"terraphim\",
\"service\": \"github\",
\"auth_token\": \"$GH_TOKEN\",
\"mirror\": true,
\"mirror_interval\": \"1h\"
}"
```
### Key Constraints
- The Gitea repo is **read-only** (mirror). All pushes go to GitHub only.
- An existing repo cannot be converted to a mirror -- must delete and recreate via `POST /repos/migrate`.
- `service: "github"` requires a valid GitHub token for private repos. `service: "git"` fails with "terminal prompts disabled".
- The 1Password item `github.personal.token` is expired. Use `gh auth token` instead.
## AI Agent Skill (Gitea Task Management)
@@ -272,7 +327,7 @@ Added `.pre-commit-config.yaml` with:
| `deploy-to-bigbox.sh` | Deployment script |
| `s3_config.json.template` | SeaweedFS S3 config template |
| `prometheus/prometheus.yml` | Prometheus scrape config |
| `.github/workflows/*.yml` | GitHub Actions for mirroring |
| `MIRRORING-GUIDE.md` | Gitea pull mirror setup (replaced GitHub Actions) |
| `.agents/skills/gitea/SKILL.md` | AI agent Gitea skill |
| `.agents/skills/gitea/setup-labels.sh` | Label setup script |
| `.agents/skills/gitea/test-gitea-skill.sh` | Integration tests |
@@ -294,14 +349,14 @@ Both cover: 1Password integration, Gitea + SeaweedFS infrastructure, all three A
## Gitea Mirror
The `gitea-infrastructure` repo is now published on both remotes:
Gitea pulls from GitHub automatically (1-hour interval). No GitHub Actions needed.
| Remote | URL |
|--------|-----|
| GitHub (origin) | https://github.com/terraphim/gitea-infrastructure |
| Gitea | https://git.terraphim.cloud/terraphim/gitea-infrastructure |
| Role | URL |
|------|-----|
| Primary (push here) | https://github.com/terraphim/gitea-infrastructure |
| Mirror (auto-synced) | https://git.terraphim.cloud/terraphim/gitea-infrastructure |
**Note:** The `sync-to-gitea.yml` GitHub Actions workflow is failing due to a billing/spending limit issue. Direct push via `op` token was used as workaround. Check GitHub **Settings > Billing & plans** to restore automated sync.
GitHub Actions workflows (`sync-to-gitea.yml`, `mirror-check.yml`) were removed -- Gitea's native pull mirror replaces them.
## Session Log (2026-02-18)
@@ -317,18 +372,18 @@ The `gitea-infrastructure` repo is now published on both remotes:
- Wrote two comparison articles (CTO voice + technical reference) comparing beads/br/agent-mail with Gitea replacement
- All code snippets, commands, and configurations verified against live Gitea instance
- Pushed all commits to GitHub origin/main
- Created `gitea-infrastructure` repo on Gitea and pushed full history
- Discovered GitHub Actions billing issue blocking automated sync-to-gitea workflow
### All Commits (pushed)
- `62e2275` docs: Add articles comparing beads/br/agent-mail with Gitea replacement
- `4ff1821` docs: Update handover and add lessons learned
- `b67284e` chore: Fix trailing whitespace across project files
- `66b305d` feat(gitea-skill): Add integration tests and fix workflow label swap
- `1fd202d` feat(gitea-skill): Rewrite Gitea agent skill with verified API patterns
### Session 3: Replace GitHub Actions with Gitea Pull Mirror
- Removed `sync-to-gitea.yml` and `mirror-check.yml` GitHub Actions workflows
- Deleted manually-pushed Gitea repo, recreated as native pull mirror via `POST /repos/migrate`
- Discovered `github.personal.token` in 1Password is expired (401); used `gh auth token` instead
- Discovered Gitea creates empty mirror repos on failed async clones (silent failure)
- Discovered `service: "git"` fails for private repos; `service: "github"` with valid token works
- Mirror interval set to 1 hour, manual sync available via API
- Updated HANDOVER.md, lessons-learned.md, and articles with new mirroring approach
### Next Steps
1. Fix GitHub Actions billing to restore automated Gitea sync
1. Update `github.personal.token` in 1Password (currently expired)
2. Consider adding gitea-mcp or forgejo-mcp as MCP server for Claude Code (see SKILL.md MCP Integration section)
3. Create first real milestone and tasks in `terraphim/agent-tasks` for a project
4. Consider Phase 4 (disciplined-verification) if more rigorous validation is needed