diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-18 17:33:11 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-18 17:33:11 +0100 |
| commit | a3d4c8eaa263f4adb174ac81c4248fa200e1857e (patch) | |
| tree | 0b786013c3b3da67123e2ff02f95b7c41eb8dfc0 /src/lib/git_events.rs | |
| parent | 3eb2354edb8e76428625d5645e110c30aa1ccc2a (diff) | |
feat(pr): fetch pr and pr updates from clone urls
we try and get them from clone urls of repo and fallback to
those specified by contributor
Diffstat (limited to 'src/lib/git_events.rs')
| -rw-r--r-- | src/lib/git_events.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs index 7b25daf..09ec040 100644 --- a/src/lib/git_events.rs +++ b/src/lib/git_events.rs | |||
| @@ -90,6 +90,19 @@ pub fn patch_supports_commit_ids(event: &Event) -> bool { | |||
| 90 | .any(|t| !t.as_slice().is_empty() && t.as_slice()[0].eq("commit-pgp-sig")) | 90 | .any(|t| !t.as_slice().is_empty() && t.as_slice()[0].eq("commit-pgp-sig")) |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | pub fn event_is_valid_pr_or_pr_update(event: &Event) -> bool { | ||
| 94 | [KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE].contains(&event.kind) | ||
| 95 | && event.tags.iter().any(|t| { | ||
| 96 | t.as_slice().len().gt(&1) | ||
| 97 | && t.as_slice()[0].eq("c") | ||
| 98 | && git2::Oid::from_str(&t.as_slice()[1]).is_ok() | ||
| 99 | }) | ||
| 100 | && event | ||
| 101 | .tags | ||
| 102 | .iter() | ||
| 103 | .any(|t| t.as_slice().len().gt(&1) && t.as_slice()[0].eq("clone")) | ||
| 104 | } | ||
| 105 | |||
| 93 | #[allow(clippy::too_many_arguments)] | 106 | #[allow(clippy::too_many_arguments)] |
| 94 | #[allow(clippy::too_many_lines)] | 107 | #[allow(clippy::too_many_lines)] |
| 95 | pub async fn generate_patch_event( | 108 | pub async fn generate_patch_event( |