2023-12-29 19:55:10 +01:00
|
|
|
use async_trait::async_trait;
|
2024-02-03 18:54:17 +01:00
|
|
|
use dagger_cuddle_please::{models::CuddlePleaseSrcArgs, DaggerCuddlePlease};
|
2023-12-29 19:55:10 +01:00
|
|
|
|
2024-02-03 18:54:17 +01:00
|
|
|
use crate::{Context, MainAction};
|
2023-12-29 19:55:10 +01:00
|
|
|
|
2024-03-30 23:34:23 +01:00
|
|
|
#[derive(Clone)]
|
2023-12-29 19:55:10 +01:00
|
|
|
pub struct CuddlePlease {
|
|
|
|
client: dagger_sdk::Query,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CuddlePlease {
|
|
|
|
pub fn new(client: dagger_sdk::Query) -> Self {
|
2024-11-16 16:09:07 +01:00
|
|
|
Self { client }
|
2023-12-29 19:55:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
impl MainAction for CuddlePlease {
|
2024-02-03 18:54:17 +01:00
|
|
|
async fn execute_main(&self, _ctx: &mut Context) -> eyre::Result<()> {
|
2023-12-29 19:55:10 +01:00
|
|
|
let client = self.client.clone();
|
|
|
|
|
|
|
|
let action = DaggerCuddlePlease::new(client);
|
|
|
|
|
|
|
|
action
|
|
|
|
.cuddle_please_src(&CuddlePleaseSrcArgs {
|
2024-04-09 23:29:13 +02:00
|
|
|
cuddle_image: "kasperhermansen/cuddle-please:main-1712698022".into(),
|
2023-12-29 19:55:10 +01:00
|
|
|
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(())
|
|
|
|
}
|
|
|
|
}
|