Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerboa-app committed Jun 2, 2024
1 parent 9f41c85 commit 585d736
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/integrations/git/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,15 @@ pub fn fast_forward_pull(repo: Repository, branch: &str) -> Result<Option<HeadIn
}
}

/// Commit hash, author and timestamp for head commit
pub struct HeadInfo
{
pub hash: git2::Oid,
pub author: String,
pub datetime: String
}

/// Get the [HeadInfo] if it exists
pub fn head_info(repo: &Repository) -> Option<HeadInfo>
{
let head = match repo.head()
Expand Down
3 changes: 3 additions & 0 deletions src/integrations/git/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ impl GitRefreshTask
}
}

/// Attempt a fast forward pull of the repo in [crate::config::ContentConfig::path]
/// clone if it is not there. Does nothing if [crate::config::GitConfig] is none
pub fn pull(config: &Config) -> Option<HeadInfo>
{

Expand Down Expand Up @@ -72,6 +74,7 @@ impl GitRefreshTask
None
}

/// Send a discord message with [HeadInfo] if it is Some
pub async fn notify_pull(info: Option<HeadInfo>, config: &Config)
{
match info
Expand Down
3 changes: 3 additions & 0 deletions src/integrations/github/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use crate::config::{Config, CONFIG_PATH};

use super::git::refresh::GitRefreshTask;

/// If user-agent is GitHub-Hookshot, check if
/// x-github-event is push. If so pull the repo if
/// [crate::config::GitConfig] is not None
pub async fn filter_github<B>
(
headers: HeaderMap,
Expand Down

0 comments on commit 585d736

Please sign in to comment.