add merge status
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2023-04-11 23:08:45 +02:00
parent 3f4657b0cf
commit e42430d24b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 23 additions and 5 deletions

View file

@ -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> {

View file

@ -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(