MCPcopy Create free account
hub / github.com/github/gh-aw / workflowIDFromPath

Function workflowIDFromPath

pkg/cli/logs_format_compact.go:18–30  ·  view source on GitHub ↗

workflowIDFromPath extracts the workflow ID from a workflow path. e.g. ".github/workflows/smoke-antigravity.lock.yml" → "smoke-antigravity"

(path string)

Source from the content-addressed store, hash-verified

16// workflowIDFromPath extracts the workflow ID from a workflow path.
17// e.g. ".github/workflows/smoke-antigravity.lock.yml" → "smoke-antigravity"
18func workflowIDFromPath(path string) string {
19 // Get the base filename
20 base := path
21 if idx := strings.LastIndex(path, "/"); idx >= 0 {
22 base = path[idx+1:]
23 }
24 // Strip .lock.yml suffix
25 base = strings.TrimSuffix(base, ".lock.yml")
26 // Strip .yml/.yaml suffix (in case it's not a lock file)
27 base = strings.TrimSuffix(base, ".yml")
28 base = strings.TrimSuffix(base, ".yaml")
29 return base
30}
31
32// workflowIDFromRun returns the workflow ID preferring the path-derived ID,
33// falling back to a lowercased/hyphenated version of the display name.

Callers 1

workflowIDFromRunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected