webhooks

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSignature = errors.New("invalid webhook signature")

Functions

func Module

func Module() fx.Option

Types

type Config

type Config struct {
	Secret       string `koanf:"secret"`
	BotUserEmail string `koanf:"bot_user_email"`
}

type KeywordAction

type KeywordAction struct {
	Status tasks.Status // target status
	Verb   string       // past-tense label for comment, e.g. "Resolved"
}

KeywordAction maps a commit message keyword to a task status transition.

type ParsedReference

type ParsedReference struct {
	TaskNumber    int
	Action        *KeywordAction // nil if bare #N with no keyword
	CommitHash    string
	CommitMessage string
}

ParsedReference represents a single task reference found in a commit message.

func ParseCommitMessage

func ParseCommitMessage(message string) []ParsedReference

ParseCommitMessage scans a commit message for task references. Returns a list of ParsedReference, one per unique #NUMBER found. If both a keyword and bare reference exist for the same number, the keyword wins.

type ProcessResult

type ProcessResult struct {
	Matched   int `json:"matched"`
	Resolved  int `json:"resolved"`
	Mentioned int `json:"mentioned"`
}

ProcessResult tracks the results of processing a push event.

func NewProcessResult

func NewProcessResult() *ProcessResult

func (*ProcessResult) AddMatched

func (r *ProcessResult) AddMatched()

func (*ProcessResult) AddMentioned

func (r *ProcessResult) AddMentioned()

func (*ProcessResult) AddResolved

func (r *ProcessResult) AddResolved()

type PushCommit

type PushCommit struct {
	Hash    string
	Message string
	Author  string
}

PushCommit is a flattened commit used by the service layer.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	cfg Config,
	projectsSvc *projects.Service,
	tasksSvc *tasks.Service,
	commentsSvc *comments.Service,
	usersSvc *users.Service,
	logger *zap.Logger,
) (*Service, error)

func (*Service) Init

func (s *Service) Init(ctx context.Context) error

func (*Service) ProcessPushEvent

func (s *Service) ProcessPushEvent(
	ctx context.Context, repoFullName string, commits []PushCommit,
) (*ProcessResult, error)

func (*Service) VerifyPushEvent

func (s *Service) VerifyPushEvent(rawBody []byte, signatureHeader string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL