Skip to content

Commit

Permalink
Merge pull request #59 from whywaita/fix/58
Browse files Browse the repository at this point in the history
searchRepo check target that can receive job
  • Loading branch information
whywaita authored May 31, 2021
2 parents 8c3ef91 + efe496d commit eca1cfb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/web/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func searchRepo(ctx context.Context, ds datastore.Datastore, gheDomain, repo str

// use repo scope if set repo
repoTarget, err := ds.GetTargetByScope(ctx, gheDomain, repo)
if err == nil {
if err == nil && repoTarget.CanReceiveJob() {
return repoTarget, nil
} else if err != datastore.ErrNotFound {
return nil, fmt.Errorf("failed to get target from repo: %w", err)
Expand All @@ -162,7 +162,7 @@ func searchRepo(ctx context.Context, ds datastore.Datastore, gheDomain, repo str
// repo is not found, so search org target
org := sep[0]
orgTarget, err := ds.GetTargetByScope(ctx, gheDomain, org)
if err != nil {
if err != nil || !orgTarget.CanReceiveJob() {
return nil, fmt.Errorf("failed to get target from organization: %w", err)
}

Expand Down

0 comments on commit eca1cfb

Please sign in to comment.