| 621 | } |
| 622 | |
| 623 | func 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 | |
| 659 | func resolveCentralSlashRunsOn(workflowDataList []*WorkflowData) string { |
| 660 | counts := map[string]int{} |