feat(providers): pull mirrors on Gitea and tea/gh token fallback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-11-16 16:54:07 +01:00
1 parent 251bfe3685
commit e2631e7ab7
6 files changed
+337 -7

No files matched your search

+28 -1
View File
@@ -1,5 +1,7 @@
use crate::http::Http;
use crate::{Capabilities, Error, MirrorSpec, NewRepo, Provider, RemoteRepo, Result};
use crate::{
Capabilities, Error, MirrorSpec, NewRepo, Provider, PullMirrorSpec, RemoteRepo, Result,
};
use grove_core::config::ProviderKind;
use serde_json::{Value, json};
@@ -40,6 +42,7 @@ impl Provider for Gitea {
fn capabilities(&self) -> Capabilities {
Capabilities {
push_mirror: true,
pull_mirror: true,
orgs: true,
}
}
@@ -94,4 +97,28 @@ impl Provider for Gitea {
)
.map(|_| ())
}
fn create_pull_mirror(&self, spec: &PullMirrorSpec) -> Result<RemoteRepo> {
let mut body = json!({
"clone_addr": spec.source_url,
"repo_name": spec.name,
"mirror": true,
"mirror_interval": spec.interval,
"private": spec.private,
"service": "git",
"description": "Mirror managed by grove",
});
if let Some(o) = &spec.owner {
body["repo_owner"] = json!(o);
}
if let Some((user, token)) = &spec.source_auth {
body["auth_username"] = json!(user);
body["auth_password"] = json!(token);
}
Ok(repo(&self.http.ok(
"POST",
"/repos/migrate",
Some(&body),
)?))
}
}