Documentation
¶
Overview ¶
Package projectref reads and writes .circleci/info.yml — the per-checkout file that records which CircleCI project this directory is bound to.
It is consulted by slug-resolution code so that repository renames and non-VCS-derived slugs (e.g. standalone projects) work without forcing every caller to pass --project explicitly.
Index ¶
Constants ¶
const FilePath = ".circleci/info.yml"
FilePath is the path to the info file relative to the checkout root.
Variables ¶
var ErrNotFound = errors.New("projectref: .circleci/info.yml not found")
ErrNotFound is returned by Read when no info file exists.
Functions ¶
Types ¶
type Info ¶
type Info struct {
Organization Organization `yaml:"organization"`
Project Project `yaml:"project"`
}
Info is the on-disk record written by `circleci project link`.
Schema:
organization: id: <uuid> # required name: <string> # optional, populated from API when available project: id: <uuid> # required slug: <string> # required — VCS-style or canonical "circleci/<orgID>/<projectID>" name: <string> # optional, populated from API when available
Project.Slug is always populated. Organization.ID and Project.ID are also populated when the slug was verified against the CircleCI API at link time; they let callers reference the project by its stable UUID even after a repo rename.
func Read ¶
Read parses .circleci/info.yml from workDir. Returns ErrNotFound if the file does not exist; other errors signal a malformed file or I/O failure.
func (*Info) EffectiveSlug ¶
EffectiveSlug returns the slug to use when calling the CircleCI API. When both Project.ID and Organization.ID are known, the canonical "circleci/<orgID>/<projectID>" form is returned so the lookup is stable across VCS-side renames; otherwise the stored Project.Slug is returned as-is.
type Organization ¶
Organization is the CircleCI organization that owns the project.