feat: extract cuddle_please
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-12-29 19:55:10 +01:00
parent 1b5ee9b7e3
commit e67c4baa97
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
3 changed files with 40 additions and 41 deletions

View File

@ -120,7 +120,7 @@ mod please_release {
cuddle_image: args cuddle_image: args
.cuddle_please_image .cuddle_please_image
.clone() .clone()
.unwrap_or("kasperhermansen/cuddle-please:main-1691504183".into()), .unwrap_or("kasperhermansen/cuddle-please:latest".into()),
server: dagger_cuddle_please::models::SrcServer::Gitea { server: dagger_cuddle_please::models::SrcServer::Gitea {
token: std::env::var("CUDDLE_PLEASE_TOKEN") token: std::env::var("CUDDLE_PLEASE_TOKEN")
.expect("CUDDLE_PLEASE_TOKEN to be present"), .expect("CUDDLE_PLEASE_TOKEN to be present"),

View File

@ -0,0 +1,38 @@
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:main-1691504183".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(())
}
}

View File

@ -2,47 +2,8 @@ pub mod cli;
pub mod leptos_service; pub mod leptos_service;
pub use cli::*; pub use cli::*;
pub mod cuddle_please;
pub mod dagger_middleware; pub mod dagger_middleware;
pub mod node_service; pub mod node_service;
pub mod rust_lib; pub mod rust_lib;
pub mod rust_service; 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(())
}
}
}