detect

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package detect scans a repository (a local checkout or, via the GitHub API, a remote repo) and recommends which prebuilt runner image flavors its CI is likely to need. It is a setup-time helper: routing at run time stays label based, so the output is a ready-to-paste pools block plus the images to pull.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(res *Result, os string) string

Render produces a human report: detected flavors, the images they map to, a ready-to-paste pools block, and the runs-on label sets found in workflows.

Types

type DirSource

type DirSource struct {
	Root string
}

DirSource scans a local checkout rooted at Root.

func (DirSource) Paths

func (d DirSource) Paths() ([]string, error)

Paths walks the directory tree, skipping dependency/output dirs, and returns repo-relative slash-separated file paths.

func (DirSource) ReadFile

func (d DirSource) ReadFile(p string) ([]byte, error)

ReadFile reads a repo-relative path from the checkout.

type Flavor

type Flavor string

Flavor is a published runner image flavor (matches config.publishedFlavors).

const (
	FlavorNativeBuild Flavor = "native-build"
	FlavorNode        Flavor = "node"
	FlavorDotnet      Flavor = "dotnet"
	FlavorRust        Flavor = "rust"
	FlavorGo          Flavor = "go"
)

type Hit

type Hit struct {
	Flavor   Flavor
	Evidence []string
}

Hit records a detected flavor and a few example files that triggered it.

type Result

type Result struct {
	Hits   []Hit      // detected flavors, in catalog order
	RunsOn [][]string // distinct runs-on label sets found in workflows
}

Result is the outcome of a scan.

func Scan

func Scan(src Source) (*Result, error)

Scan inspects the source and returns detected flavors + workflow runs-on sets.

type Source

type Source interface {
	Paths() ([]string, error)
	ReadFile(path string) ([]byte, error)
}

Source provides the file paths and (for workflows) file contents of a repo. Paths are repo-relative and slash-separated.

Jump to

Keyboard shortcuts

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