gitfrog

Get current info about PRs and issues

4 releases

0.1.3 Apr 27, 2024
0.1.2 Apr 8, 2024
0.1.1 Mar 22, 2024
0.1.0 Mar 19, 2024


Used in grawler

GPL-3.0 license

18KB
346 lines

gitfrog

Tests

Get current info about PRs and issues

Supported

  • Github, Gitlab, Gitea
  • Bugzilla

Examples

Auto-detection for well-known forges

use gitfrog::Info;

let url = Url::parse("https://github.com/catppuccin/nvim/pull/8").unwrap();
let info = Info::from_url(&url).await.unwrap();

assert_eq!(info.title, "Add Kitty themes");
assert_eq!(info.state, State::Closed);
assert_eq!(info.state.is_open(), false);

[!NOTE] Feel free to file an issue about missing forges. Contributions are welcome too!

Self-hosted instances

use gitfrog::Host;

let url = Url::parse("https://gitlab.freedesktop.org/wayland/wayland/-/issues/369").unwrap();
let domain = url.domain().unwrap();
let info = Host::Gitlab(domain).get(&url).await.unwrap();

assert_eq!(info.title, "libwayland-server.so.0.21.0 ends in segfault and then somehow shuts down my system.");
assert_eq!(info.state, State::Closed);
assert_eq!(info.state.is_open(), false);

Multiple urls in parallel

let wrapper = |x| Url::parse(&format!("https://github.com/catppuccin/nvim/pull/{x}")).unwrap();
let urls: Vec<Url> = vec![110, 143, 1].iter().map(wrapper).collect();

let info = Info::from_urls(&urls).await;

assert_eq!(info[0].as_ref().unwrap().title, "fix: typo");
assert_eq!(info[1].as_ref().unwrap().title, "fix: #103");
assert_eq!(info[2].is_err(), true);

Dependencies

~8–21MB
~313K SLoC