Documentation
¶
Index ¶
- Constants
- func GenerateID(typ, repo string, number int, conditions, until []string, maxCount int, ...) string
- func SplitRepo(repo string) (string, string)
- type WatchRule
- func (r *WatchRule) ClearFiredState(condition string)
- func (r *WatchRule) CompiledIgnoreUsers() []*regexp.Regexp
- func (r *WatchRule) HasFiredForState(condition, stateKey string) bool
- func (r *WatchRule) IsOneShot() bool
- func (r *WatchRule) PollInterval() time.Duration
- func (r *WatchRule) RecordFiredState(condition, stateKey string)
- func (r *WatchRule) SinceTime() time.Time
Constants ¶
View Source
const DefaultInterval = 30 * time.Second
View Source
const DefaultIntervalStr = "30sec"
Variables ¶
This section is empty.
Functions ¶
func GenerateID ¶
Types ¶
type WatchRule ¶
type WatchRule struct {
ID string `json:"id"`
Type string `json:"type"` // "pr", "issue"
Repo string `json:"repo"` // "owner/repo"
Number int `json:"number"`
Conditions []string `json:"conditions"` // OR evaluation
Action string `json:"action"` // "open", "notify"
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
Status string `json:"status"` // "watching", "triggered", "stopped"
Until []string `json:"until,omitempty"` // termination conditions (any match ends the rule)
MaxCount int `json:"max_count,omitempty"` // 0=unlimited, N=end after N triggers
TriggerCount int `json:"trigger_count"` // current trigger count
LastCheckedAt time.Time `json:"last_checked_at,omitzero"`
Interval string `json:"interval,omitempty"` // polling interval (e.g., "30sec", "5min", "1h")
IgnoreUsers []string `json:"ignore_users,omitempty"` // regex patterns of users to ignore
FiredStates map[string]string `json:"fired_states,omitempty"` // state-based condition dedup (condition -> stateKey)
// contains filtered or unexported fields
}
func (*WatchRule) ClearFiredState ¶ added in v0.3.2
ClearFiredState removes a condition from fired states (e.g., state reverted).
func (*WatchRule) CompiledIgnoreUsers ¶ added in v0.3.0
CompiledIgnoreUsers returns pre-compiled regexps for IgnoreUsers patterns. Invalid patterns are silently skipped (validated at rule creation time).
func (*WatchRule) HasFiredForState ¶ added in v0.3.2
HasFiredForState returns true if the condition has already fired with the given stateKey.
func (*WatchRule) IsOneShot ¶
IsOneShot returns true if the rule should be removed after the first trigger (legacy behavior).
func (*WatchRule) PollInterval ¶ added in v0.2.0
PollInterval returns the rule's polling interval as time.Duration. Falls back to DefaultInterval if not set or invalid.
func (*WatchRule) RecordFiredState ¶ added in v0.3.2
RecordFiredState marks a condition as fired with the given stateKey.
Click to show internal directories.
Click to hide internal directories.