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

Function buildCommandsHeaderMetadata

pkg/workflow/central_slash_command_workflow.go:623–657  ·  view source on GitHub ↗
(slashRoutesByCommand map[string][]slashCommandRoute, labelRoutesByCommand map[string][]slashCommandRoute)

Source from the content-addressed store, hash-verified

621}
622
623func buildCommandsHeaderMetadata(slashRoutesByCommand map[string][]slashCommandRoute, labelRoutesByCommand map[string][]slashCommandRoute) commandsHeaderMetadata {
624 commands := make([]string, 0, len(slashRoutesByCommand))
625 workflowSet := make(map[string]struct {
626 })
627 for command, routes := range slashRoutesByCommand {
628 commands = append(commands, command)
629 for _, route := range routes {
630 if route.Workflow != "" {
631 workflowSet[route.Workflow] = struct {
632 }{}
633 }
634 }
635 }
636 for _, routes := range labelRoutesByCommand {
637 for _, route := range routes {
638 if route.Workflow != "" {
639 workflowSet[route.Workflow] = struct {
640 }{}
641 }
642 }
643 }
644 sort.Strings(commands)
645 workflows := sliceutil.SortedKeys(workflowSet)
646 metadataCompilerVersion := "dev"
647 if IsRelease() && strings.TrimSpace(GetVersion()) != "" {
648 metadataCompilerVersion = GetVersion()
649 }
650 return commandsHeaderMetadata{
651 PayloadVersion: "v1",
652 SchemaVersion: "v1",
653 Compiler: metadataCompilerVersion,
654 Commands: commands,
655 Workflows: workflows,
656 }
657}
658
659func resolveCentralSlashRunsOn(workflowDataList []*WorkflowData) string {
660 counts := map[string]int{}

Calls 3

SortedKeysFunction · 0.92
IsReleaseFunction · 0.85
GetVersionFunction · 0.70