implement compose secret syntax

This commit is contained in:
Brad Rydzewski
2017-04-10 12:39:50 +02:00
parent 4502e5a256
commit b10a074b57
13 changed files with 132 additions and 76 deletions

23
model/gate.go Normal file
View File

@@ -0,0 +1,23 @@
package model
// Gated indicates a build is gated and requires approval to proceed. It also
// includes the reason the build was gated.
type Gated struct {
Gated bool `json:"gated"`
Reason string `json:"reason"`
}
// GateService defines a service for gating builds.
type GateService interface {
Gated(*User, *Repo, *Build) (*Gated, error)
}
type gateService struct{}
func (s *gateService) Gated(owner *User, repo *Repo, build *Build) (*Gated, error) {
g := new(Gated)
if repo.IsPrivate && build.Event == EventPull && build.Sender != owner.Login {
g.Gated = true
}
return g, nil
}