Merge pull request #147 from sgotti/fix_when_reftype_tag
when: fix typo in tag matching
This commit is contained in:
commit
400de5f720
|
@ -58,7 +58,7 @@ func MatchWhen(when *When, refType itypes.RunRefType, branch, tag, ref string) b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// test only if tag is not empty, if empty mean that we are not in a tag
|
// test only if tag is not empty, if empty mean that we are not in a tag
|
||||||
if refType == itypes.RunRefTypeBranch && when.Tag != nil && tag != "" {
|
if refType == itypes.RunRefTypeTag && when.Tag != nil && tag != "" {
|
||||||
// first check includes and override with excludes
|
// first check includes and override with excludes
|
||||||
if matchCondition(when.Tag.Include, tag) {
|
if matchCondition(when.Tag.Include, tag) {
|
||||||
include = true
|
include = true
|
||||||
|
|
|
@ -284,7 +284,7 @@ func TestMatchWhen(t *testing.T) {
|
||||||
out: false,
|
out: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test only matching reftype",
|
name: "test only matching branch reftype",
|
||||||
when: &When{
|
when: &When{
|
||||||
Branch: &WhenConditions{
|
Branch: &WhenConditions{
|
||||||
Include: []WhenCondition{
|
Include: []WhenCondition{
|
||||||
|
@ -298,6 +298,21 @@ func TestMatchWhen(t *testing.T) {
|
||||||
tag: "master",
|
tag: "master",
|
||||||
out: false,
|
out: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test only matching tag reftype",
|
||||||
|
when: &When{
|
||||||
|
Tag: &WhenConditions{
|
||||||
|
Include: []WhenCondition{
|
||||||
|
{Type: WhenConditionTypeSimple, Match: "master"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
refType: itypes.RunRefTypeBranch,
|
||||||
|
branch: "master",
|
||||||
|
// we provide also a value to tag (should not be done)
|
||||||
|
tag: "master",
|
||||||
|
out: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
Loading…
Reference in New Issue