platform

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package platform defines the platform-neutral types (repos, events) and the interface every git hosting adapter implements.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthorized = errors.New("webhook authentication failed")

ErrUnauthorized is returned by ParseWebhook when authentication fails.

Functions

func BranchHasPrefix added in v0.3.0

func BranchHasPrefix(prefixes []string, branch string) bool

BranchHasPrefix reports whether branch starts with any of the prefixes.

func CheckedItems

func CheckedItems(text string) int

CheckedItems counts checked markdown todo items ("- [x] ...") in text. Used to detect Renovate checkbox ticks in MR/issue descriptions: a tick is a transition where the checked count increases.

func CheckedMarkerItems added in v0.2.0

func CheckedMarkerItems(text string) int

CheckedMarkerItems counts checked todo items that carry a Renovate HTML comment marker (e.g. "- [x] <!-- rebase-check -->..."). Renovate embeds such markers in every actionable checkbox, so this filters out ordinary human task lists.

func HasRenovateDebugMarker added in v0.3.0

func HasRenovateDebugMarker(text string) bool

HasRenovateDebugMarker reports whether text contains renovate's debug HTML comment ("<!--renovate-debug:...-->"). Renovate appends it to every MR/PR description, so it reliably identifies renovate MRs even when the checkbox lines carry no markers.

func RepoAllowed added in v0.2.0

func RepoAllowed(groups []string, fullName string) bool

RepoAllowed reports whether a repo full name is inside one of the configured groups/orgs (path-prefix match, case-insensitive). With no groups configured, all repos are allowed.

Types

type Event

type Event struct {
	Repo   Repo
	Reason Reason
}

Event is a normalized trigger extracted from a webhook or schedule.

type Platform

type Platform interface {
	Name() string
	WebhookPath() string
	// ParseWebhook authenticates and parses a webhook request. body is the
	// already-read request body. Returns (nil, nil) when the event needs no
	// action, ErrUnauthorized when authentication fails.
	ParseWebhook(r *http.Request, body []byte) (*Event, error)
	// DiscoverRepos lists all repos under the configured groups/orgs.
	DiscoverRepos(ctx context.Context) ([]Repo, error)
	// Schedule returns the cron schedule config for this platform.
	Schedule() config.Schedule
}

Platform abstracts a git hosting platform.

type Reason

type Reason string

Reason describes why a run was requested.

const (
	ReasonMergeRequest Reason = "merge_request"
	ReasonIssue        Reason = "issue"
	ReasonPush         Reason = "push"
	ReasonCron         Reason = "cron"
	ReasonRerun        Reason = "rerun"
)

Reasons a run can be requested for.

type Repo

type Repo struct {
	Platform string // platform config name
	FullName string // e.g. "group/subgroup/project"
}

Repo identifies a repository on a configured platform.

func (Repo) Key

func (r Repo) Key() string

Key returns the unique dispatch key for the repo.

Directories

Path Synopsis
Package github adapts GitHub (cloud or enterprise) to the platform interface: org webhook parsing and repo discovery.
Package github adapts GitHub (cloud or enterprise) to the platform interface: org webhook parsing and repo discovery.
Package gitlab adapts a GitLab instance to the platform interface: group webhook parsing and project discovery.
Package gitlab adapts a GitLab instance to the platform interface: group webhook parsing and project discovery.

Jump to

Keyboard shortcuts

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