This commit is contained in:
parent
3f4657b0cf
commit
e42430d24b
2 changed files with 23 additions and 5 deletions
|
@ -11,9 +11,17 @@ pub struct GithubResponse {
|
|||
|
||||
#[derive(Deserialize)]
|
||||
pub struct GithubProject {
|
||||
pub title: String,
|
||||
pub html_url: String,
|
||||
pub repository_url: String,
|
||||
pub number: u32,
|
||||
pub title: String,
|
||||
pub state: String,
|
||||
pub pull_request: GithubPullRequest,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct GithubPullRequest {
|
||||
pub html_url: String,
|
||||
pub merged_at: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn fetch_pr() -> Result<GithubResponse, Error> {
|
||||
|
|
|
@ -16,9 +16,19 @@ pub async fn get_page(config: Config) -> std::string::String {
|
|||
// Fetch latest data from github
|
||||
if let Ok(resp) = fetch_pr().await {
|
||||
println!("Nb: {}", resp.total_count);
|
||||
resp.items
|
||||
.iter()
|
||||
.for_each(|x| println!("[{0} #{2}]({1})", x.title, x.html_url, x.number));
|
||||
resp.items.iter().for_each(|x| {
|
||||
println!(
|
||||
"[{} #{}]({}) - {}",
|
||||
x.title,
|
||||
x.number,
|
||||
x.pull_request.html_url,
|
||||
if x.pull_request.merged_at.is_none() {
|
||||
&x.state
|
||||
} else {
|
||||
"merged"
|
||||
}
|
||||
)
|
||||
});
|
||||
};
|
||||
|
||||
config.tmpl.render(
|
||||
|
|
Loading…
Reference in a new issue