| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
The github package provides label-based objective value mapping for issue prioritization scoring.
This package defines how GitHub issue labels are translated into numeric objective values. It supports configurable mapping strategies (max, sum, first) and can load its configuration from an environment variable, a repository config file, or built-in defaults.
| Type | Description |
|---|---|
| ObjectiveMapping | Defines how GitHub labels map to numeric objective values, including the combination logic for multiple matching labels |
| Field | Type | Description |
|---|---|---|
| LabelToValue | map[string]int | Maps label names (case-insensitive) to numeric values |
| MultiLabelLogic | string | How multiple matching labels are combined: "max" (default), "sum", or "first" |
| PriorityLabels | []string | Evaluation order when MultiLabelLogic is "first" |
| Method | Signature | Description |
|---|---|---|
| ComputeObjectiveValue | func(issueLabels []string) int | Calculates the numeric value for an issue based on its labels; returns 0 if no labels match or if the receiver is nil |
| FilterObjectiveLabels | func(issueLabels []string) []string | Returns the subset of issueLabels that have defined objective values, preserving original order |
| HasObjectiveLabel | func(label string) bool | Reports whether a given label has a defined objective value |
| GetAllLabels | func() []string | Returns all labels defined in the mapping, sorted alphabetically |
| MarshalJSON | func() ([]byte, error) | Implements json.Marshaler; produces indented JSON output |
| String | func() string | Returns a human-readable summary: ObjectiveMapping{labels: N, logic: X, priorities: M} |
| Function | Signature | Description |
|---|---|---|
| DefaultObjectiveMapping | func() *ObjectiveMapping | Returns the built-in default label-to-value mapping |
| LoadObjectiveMapping | func() *ObjectiveMapping | Loads the mapping from environment, config file, or defaults (see precedence below) |
The package exports constants for multi-label logic options:
| Constant | Value | Description |
|---|---|---|
| MultiLabelLogicMax | "max" | Use the highest matching label value (default) |
| MultiLabelLogicSum | "sum" | Sum all matching label values |
| MultiLabelLogicFirst | "first" | Use the first match in priority order |
For backward compatibility, deprecated exported ObjectiveLabel* and ObjectiveValue* constants are still available for external consumers. Runtime scoring behavior is not derived from those constants.
Default label-to-value entries are provided by DefaultObjectiveMapping():
| Label | Value |
|---|---|
| critical | 100 |
| p0 | 100 |
| security-fix | 75 |
| high-priority | 50 |
| copilot-opt | 50 |
| p1 | 50 |
| performance | 30 |
| medium-priority | 25 |
| p2 | 25 |
| low-priority | 10 |
| p3 | 10 |
| documentation | 5 |
Labels not listed above (for example bug, testing, and reliability) are not part of the default mapping and evaluate to 0 unless provided by configuration.
LoadObjectiveMapping resolves the mapping in this order:
import "github.com/github/gh-aw/pkg/github"
// Load mapping (env > config file > defaults)
om := github.LoadObjectiveMapping()
// Score an issue by its labels (default mapping: critical=100, high-priority=50, p1=50, ...)
score := om.ComputeObjectiveValue([]string{"critical", "high-priority"})
// score == 100 (max of critical=100, high-priority=50)
// Check which labels contributed
objectiveLabels := om.FilterObjectiveLabels([]string{"critical", "high-priority"})
// objectiveLabels == ["critical", "high-priority"]
// Use the default mapping directly
defaults := github.DefaultObjectiveMapping()
fmt.Println(defaults) // ObjectiveMapping{labels: 12, logic: max, priorities: 7}Internal:
External:
This specification is automatically maintained by the spec-extractor workflow.
| Back | FazBrowse Home | New Git URL |