File: update_pull_request_branch.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 (26 lines) | stat: -rwxr-xr-x 721 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
#!/usr/bin/env rust-script

//! Dependencies can be specified in the script file itself as follows:
//!
//! ```cargo
//! [dependencies]
//! tokio = { version = "1.6.1", default-features = false, features = ["macros", "rt-multi-thread", "time"] }
//! octocrab = { path = "../" }
//! ```

use octocrab::Octocrab;

#[tokio::main]
async fn main() -> octocrab::Result<()> {
    let token = std::env::var("GITHUB_TOKEN").expect("GITHUB_TOKEN env variable is required");
    let octocrab = Octocrab::builder().personal_token(token).build()?;

    let update = octocrab
        .pulls("XAMPPRocky", "octocrab")
        .update_branch(200)
        .await?;

    println!("Result of pull request update: {update}",);

    Ok(())
}