Skip to content

Commit

Permalink
fix: filtering condition (#80)
Browse files Browse the repository at this point in the history
* fix: bug with no build found (#1)

* fix: staticcheck

* Fix condition to find last build
  • Loading branch information
alikhil authored Oct 5, 2022
1 parent d582a12 commit eb202d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (p *Plugin) Execute() error {
if p.settings.LastSuccessful {
// Get the last successful build of branch
build, err = findFirstBuild(client, owner, name, func(b *drone.Build) bool {
return b.Source == branch && b.Status == drone.StatusPassing
return b.Source == branch && b.Status == drone.StatusPassing && b.Event == "push"
})

if err != nil {
Expand Down Expand Up @@ -206,7 +206,7 @@ func (p *Plugin) Execute() error {
} else if p.settings.LastSuccessful && build.Status != drone.StatusPassing {

build, err = findFirstBuild(client, owner, name, func(b *drone.Build) bool {
return b.Source == branch && b.Status == drone.StatusPassing
return b.Source == branch && b.Status == drone.StatusPassing && b.Event == "push"
})

if err != nil {
Expand Down

0 comments on commit eb202d9

Please sign in to comment.