|
@@ -1,4 +1,4 @@
|
|
-use chrono::{DateTime, Utc};
|
|
|
|
|
|
+use chrono::{DateTime, Duration, Utc};
|
|
use std::collections::HashMap;
|
|
use std::collections::HashMap;
|
|
use std::sync::Arc;
|
|
use std::sync::Arc;
|
|
|
|
|
|
@@ -7,7 +7,10 @@ use reqwest::Client;
|
|
use serde::{Deserialize, Serialize};
|
|
use serde::{Deserialize, Serialize};
|
|
use tera::{Context, Tera};
|
|
use tera::{Context, Tera};
|
|
|
|
|
|
-use crate::github::{self, GithubClient, Repository};
|
|
|
|
|
|
+use crate::{
|
|
|
|
+ github::{self, GithubClient, Repository},
|
|
|
|
+ http_client::{CompilerMeeting, HttpClient},
|
|
|
|
+};
|
|
|
|
|
|
#[async_trait]
|
|
#[async_trait]
|
|
pub trait Action {
|
|
pub trait Action {
|
|
@@ -86,6 +89,15 @@ impl<'a> Action for Step<'a> {
|
|
async fn call(&self) -> anyhow::Result<String> {
|
|
async fn call(&self) -> anyhow::Result<String> {
|
|
let gh = GithubClient::new_with_default_token(Client::new());
|
|
let gh = GithubClient::new_with_default_token(Client::new());
|
|
|
|
|
|
|
|
+ // retrieve all Rust compiler meetings
|
|
|
|
+ // from today for 7 days
|
|
|
|
+ let today: chrono::DateTime<chrono::Local> = chrono::Local::now();
|
|
|
|
+ let tcompiler_meetings: Vec<CompilerMeeting> =
|
|
|
|
+ CompilerMeeting::get_meetings(today, today + Duration::days(7))
|
|
|
|
+ .await
|
|
|
|
+ .map_err(|e| format!("Meetings couldn't be retrieved: {:?}", e))
|
|
|
|
+ .unwrap_or_default();
|
|
|
|
+
|
|
let mut context = Context::new();
|
|
let mut context = Context::new();
|
|
let mut results = HashMap::new();
|
|
let mut results = HashMap::new();
|
|
|
|
|
|
@@ -143,6 +155,9 @@ impl<'a> Action for Step<'a> {
|
|
let date = chrono::Utc::today().format("%Y-%m-%d").to_string();
|
|
let date = chrono::Utc::today().format("%Y-%m-%d").to_string();
|
|
context.insert("CURRENT_DATE", &date);
|
|
context.insert("CURRENT_DATE", &date);
|
|
|
|
|
|
|
|
+ // populate T-compiler meetings
|
|
|
|
+ context.insert("meetings_tcompiler", &tcompiler_meetings);
|
|
|
|
+
|
|
Ok(TEMPLATES
|
|
Ok(TEMPLATES
|
|
.render(&format!("{}.tt", self.name), &context)
|
|
.render(&format!("{}.tt", self.name), &context)
|
|
.unwrap())
|
|
.unwrap())
|