Compare commits

..

2 commits

Author SHA1 Message Date
2750b76391 WIP: add github crate
All checks were successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
2024-05-28 06:45:49 +01:00
9f04b1ae6c fix: remove old implementation of forgejo get all branches
All checks were successful
Rust / build (push) Successful in 1m10s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
2024-05-28 06:45:49 +01:00
4 changed files with 0 additions and 54 deletions

View file

@ -1,45 +0,0 @@
use git_next_config as config;
use git_next_git as git;
use kxio::network::{self, Network};
pub async fn get_all(
repo_details: &git::RepoDetails,
net: &Network,
) -> git::branch::Result<Vec<config::BranchName>> {
let hostname = &repo_details.forge.hostname();
let repo_path = &repo_details.repo_path;
use secrecy::ExposeSecret;
let token = repo_details.forge.token().expose_secret();
let url = network::NetUrl::new(format!(
"https://{hostname}/api/v1/repos/{repo_path}/branches?token={token}"
));
let request = network::NetRequest::new(
network::RequestMethod::Get,
url,
network::NetRequestHeaders::new(),
network::RequestBody::None,
network::ResponseType::Json,
None,
network::NetRequestLogging::None,
);
let response = net.get::<Vec<Branch>>(request).await?;
let branches = response
.response_body()
.unwrap_or_default()
.into_iter()
.map(config::BranchName::from)
.collect::<Vec<_>>();
Ok(branches)
}
#[derive(Debug, serde::Deserialize)]
struct Branch {
name: String,
}
impl From<Branch> for config::BranchName {
fn from(value: Branch) -> Self {
Self::new(value.name)
}
}

View file

@ -1,3 +0,0 @@
mod get_all;
pub use get_all::get_all;

View file

@ -1,5 +1,3 @@
pub mod branch;
use git_next_git as git;
use kxio::network::{self, Network};

View file

@ -2,7 +2,6 @@
#![allow(dead_code)]
use derive_more::Constructor;
use git_next_config as config;
use git_next_git as git;
use kxio::network::Network;
@ -19,9 +18,6 @@ impl git_next_git::ForgeLike for Github {
fn name(&self) -> String {
"github".to_string()
}
async fn branches_get_all(&self) -> Result<Vec<config::BranchName>, git::branch::Error> {
todo!();
}
/// Checks the results of any (e.g. CI) status checks for the commit.
async fn commit_status(&self, _commit: &git::Commit) -> git::commit::Status {