Sub-crate: forgejo-hooks
Supports commit push for the moment Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
991474e4ad
commit
b9b0303e88
2 changed files with 70 additions and 0 deletions
7
forgejo-hooks/Cargo.toml
Normal file
7
forgejo-hooks/Cargo.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "forgejo-hooks"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
63
forgejo-hooks/src/lib.rs
Normal file
63
forgejo-hooks/src/lib.rs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct CommitAuthor {
|
||||||
|
pub name: String,
|
||||||
|
pub email: String,
|
||||||
|
pub username: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct User {
|
||||||
|
pub id: u32,
|
||||||
|
pub login: String,
|
||||||
|
pub full_name: String,
|
||||||
|
pub email: String,
|
||||||
|
pub avatar_url: String,
|
||||||
|
pub username: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct Commit {
|
||||||
|
pub id: String,
|
||||||
|
pub message: String,
|
||||||
|
pub url: String,
|
||||||
|
pub author: CommitAuthor,
|
||||||
|
pub committer: CommitAuthor,
|
||||||
|
pub timestamp: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct Repository {
|
||||||
|
pub id: u32,
|
||||||
|
pub owner: User,
|
||||||
|
pub name: String,
|
||||||
|
pub full_name: String,
|
||||||
|
pub description: String,
|
||||||
|
pub private: bool,
|
||||||
|
pub fork: bool,
|
||||||
|
pub html_url: String,
|
||||||
|
pub ssh_url: String,
|
||||||
|
pub clone_url: String,
|
||||||
|
pub website: String,
|
||||||
|
pub stars_count: u32,
|
||||||
|
pub forks_count: u32,
|
||||||
|
pub watchers_count: u32,
|
||||||
|
pub open_issues_count: u32,
|
||||||
|
pub default_branch: String,
|
||||||
|
pub created_at: String,
|
||||||
|
pub updated_at: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct Hook {
|
||||||
|
#[serde(rename(deserialize = "ref"))]
|
||||||
|
pub ref_: String,
|
||||||
|
pub before: String,
|
||||||
|
pub compare_url: String,
|
||||||
|
pub commits: Vec<Commit>,
|
||||||
|
pub repository: Repository,
|
||||||
|
pub pusher: User,
|
||||||
|
pub sender: User,
|
||||||
|
}
|
Loading…
Reference in a new issue