mirror of
https://github.com/harness/drone.git
synced 2025-05-10 22:21:22 +08:00
fix no protection rule violations blocking PR merge (#680)
This commit is contained in:
parent
419fe92dde
commit
63d1565a51
@ -55,16 +55,24 @@ func (s ruleSet) CanMerge(ctx context.Context, in CanMergeInput) ([]types.RuleVi
|
||||
return nil, err
|
||||
}
|
||||
|
||||
backFillRule(vs, &r)
|
||||
violations = append(violations, backFillRule(vs, &r)...)
|
||||
|
||||
violations = append(violations, vs...)
|
||||
}
|
||||
|
||||
return violations, nil
|
||||
}
|
||||
|
||||
func backFillRule(vs []types.RuleViolations, rule *types.Rule) {
|
||||
func backFillRule(vs []types.RuleViolations, rule *types.Rule) []types.RuleViolations {
|
||||
violations := make([]types.RuleViolations, 0, len(vs))
|
||||
|
||||
for i := range vs {
|
||||
if len(vs[i].Violations) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
vs[i].Rule = rule
|
||||
violations = append(violations, vs[i])
|
||||
}
|
||||
|
||||
return violations
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user