File: list_all_workflow_runs.rs

package info (click to toggle)
rust-octocrab 0.43.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,532 kB
  • sloc: makefile: 2
file content (30 lines) | stat: -rw-r--r-- 828 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use octocrab::Octocrab;

#[tokio::main]
async fn main() -> octocrab::Result<()> {
    let octocrab = Octocrab::builder().build()?;
    let runs = octocrab
        .workflows("rust-lang-ci", "rust")
        .list_all_runs()
        .per_page(2)
        .branch("master")
        .event("push")
        .status("success")
        .send()
        .await?;

    for run in runs {
        println!("Run:");
        println!("  ID: {}", run.id);
        println!("  Name: {}", run.name);
        println!("  Event: {}", run.event);
        println!("  Branch: {}", run.head_branch);
        println!("  Created At: {}", run.created_at);
        println!("  Commit:");
        println!("    Author: {}", run.head_commit.author.name);
        println!("    Message: {}", run.head_commit.message);
        println!()
    }

    Ok(())
}