Add support for tags.
This commit is contained in:
@@ -34,7 +34,7 @@ pub(crate) async fn discover_matching_push_triggers<RE: AsRef<str>>(
|
||||
remote_config: &RemoteConfig,
|
||||
) -> Result<Vec<PipelineTemplate>, Box<dyn std::error::Error>> {
|
||||
let mut ret = Vec::new();
|
||||
let ref_to_branch_regex = Regex::new(r"refs/heads/(?P<branch>.+)")?;
|
||||
let ref_to_branch_regex = Regex::new(r"refs/(heads|tags)/(?P<branch>.+)")?;
|
||||
let captures = ref_to_branch_regex
|
||||
.captures(git_ref.as_ref())
|
||||
.ok_or("Could not find branch name.")?;
|
||||
|
||||
@@ -166,7 +166,7 @@ pub(crate) trait PipelineParamters {
|
||||
|
||||
impl PipelineParamters for HookPush {
|
||||
fn get_pull_base_ref(&self) -> Result<Cow<str>, Box<dyn std::error::Error>> {
|
||||
let ref_to_branch_regex = Regex::new(r"refs/heads/(?P<branch>.+)")?;
|
||||
let ref_to_branch_regex = Regex::new(r"refs/(heads|tags)/(?P<branch>.+)")?;
|
||||
let captures = ref_to_branch_regex
|
||||
.captures(self.ref_field.as_str())
|
||||
.ok_or("Could not find branch name.")?;
|
||||
|
||||
@@ -62,7 +62,7 @@ impl RemoteConfig {
|
||||
.iter()
|
||||
.map(|s| Regex::new(s.as_str()))
|
||||
.collect::<Result<_, _>>()?;
|
||||
if !push.branches.is_empty() && !match_regex.iter().any(|r| r.is_match(branch)) {
|
||||
if !push.branches.is_empty() && match_regex.iter().any(|r| r.is_match(branch)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user