Skip to content

Commit

Permalink
secret event can be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed May 19, 2017
1 parent 108e3fe commit 3f3abe8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions model/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type Secret struct {

// Match returns true if an image and event match the restricted list.
func (s *Secret) Match(event string) bool {
if len(s.Events) == 0 {
return true
}
for _, pattern := range s.Events {
if match, _ := filepath.Match(pattern, event); match {
return true
Expand Down
4 changes: 4 additions & 0 deletions model/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ func TestSecret(t *testing.T) {
secret.Events = []string{"pull_request"}
g.Assert(secret.Match("push")).IsFalse()
})
g.It("should match when no event filters defined", func() {
secret := Secret{}
g.Assert(secret.Match("pull_request")).IsTrue()
})
g.It("should pass validation")
g.Describe("should fail validation", func() {
g.It("when no image")
Expand Down

0 comments on commit 3f3abe8

Please sign in to comment.