dagger-components/crates/cuddle-ci/src/lib.rs

49 lines
1.3 KiB
Rust
Raw Normal View History

pub mod cli;
pub mod leptos_service;
pub use cli::*;
pub mod dagger_middleware;
pub mod node_service;
pub mod rust_lib;
pub mod rust_service;
pub mod cuddle_please {
use async_trait::async_trait;
use dagger_cuddle_please::{
models::CuddlePleaseSrcArgs, DaggerCuddlePlease, DaggerCuddlePleaseAction,
};
use crate::{MainAction, PullRequestAction};
pub struct CuddlePlease {
client: dagger_sdk::Query,
}
impl CuddlePlease {
pub fn new(client: dagger_sdk::Query) -> Self {
Self { client }
}
}
#[async_trait]
impl MainAction for CuddlePlease {
async fn execute_main(&self) -> eyre::Result<()> {
let client = self.client.clone();
let action = DaggerCuddlePlease::new(client);
action
.cuddle_please_src(&CuddlePleaseSrcArgs {
cuddle_image: "kasperhermansen/cuddle-please:latest".into(),
server: dagger_cuddle_please::models::SrcServer::Gitea {
token: std::env::var("CUDDLE_PLEASE_TOKEN")
.expect("CUDDLE_PLEASE_TOKEN to be present"),
},
log_level: Some(dagger_cuddle_please::models::LogLevel::Debug),
})
.await?;
Ok(())
}
}
}