fix logic to detect if pull request

This commit is contained in:
Brad Rydzewski 2015-09-03 23:56:52 -07:00
parent dbf0fa6ee0
commit d4c7e7bf59
2 changed files with 6 additions and 2 deletions

View file

@ -155,7 +155,7 @@ func (r *Runner) Run(w *queue.Work) error {
worker := newWorker(client)
workers = append(workers, worker)
cname := cname(job)
pullrequest := (w.Build.PullRequest != nil)
pullrequest := (w.Build.PullRequest != nil && w.Build.PullRequest.Number != 0)
state, builderr := worker.Build(cname, in, pullrequest)
switch {

View file

@ -6,6 +6,7 @@ import (
"strconv"
"time"
log "github.com/drone/drone/Godeps/_workspace/src/github.com/Sirupsen/logrus"
"github.com/drone/drone/Godeps/_workspace/src/github.com/gin-gonic/gin"
"github.com/drone/drone/pkg/queue"
common "github.com/drone/drone/pkg/types"
@ -184,7 +185,10 @@ func RunBuild(c *gin.Context) {
if repo.Params != nil && len(repo.Params) != 0 {
raw = []byte(inject.InjectSafe(string(raw), repo.Params))
}
encrypted, _ := secure.Parse(repo.Keys.Private, repo.Hash, string(raw))
encrypted, err := secure.Parse(repo.Keys.Private, repo.Hash, string(raw))
if err != nil {
log.Errorf("failure to decrypt secure parameters for %s. %s", repo.FullName, err)
}
if encrypted != nil && len(encrypted) != 0 {
raw = []byte(inject.InjectSafe(string(raw), encrypted))
}