Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvaluatePushPathGlobFilter ¶
func EvaluatePushPathGlobFilter( patterns []string, changedFiles []string, onInvalidPattern func(pattern string), onMatchError func(pattern string, err error), onBypassFilter func(reason string), ) bool
EvaluatePushPathGlobFilter returns true if the push should pass the path gate.
patterns should already be trimmed (callers normally use TrimNonEmptyStrings first). If patterns is empty, the function returns true (no path restriction) so accidental misuse does not block every webhook; github.onPush only calls when len(patterns) > 0.
onBypassFilter, if non-nil, is invoked when the path filter is not applied because configured patterns are unusable (fail-open), with a short English reason for logs.
Semantics:
- If the user configured positive globs but none are valid, and there are no valid excludes, the filter is bypassed (returns true).
- If every positive glob is invalid but at least one exclude is valid, an implicit include of "**" is used so excludes still apply.
- If, after validation, there is no effective restriction (no valid includes and no valid excludes), the filter is bypassed (returns true).
- Otherwise: true when some changed file matches a valid include and matches no valid exclude. Exclude-only lists use an implicit include of "**".
onMatchError is called when doublestar.Match returns an error (should be rare after ValidatePattern).
func TrimNonEmptyStrings ¶
TrimNonEmptyStrings returns trimmed elements, skipping those that trim to empty.
Types ¶
This section is empty.