Skip to content

Commit

Permalink
commit to feature/add-homerun-survey
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-hermann-sva committed Jan 19, 2025
1 parent 67be982 commit 696a614
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
19 changes: 18 additions & 1 deletion cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,21 @@ var pushCmd = &cobra.Command{
values = sthingsBase.MergeMaps(aliases, values)

fmt.Println(values)
values["authors"] = demo.Authors

// SET VALUES

// LOOP OVER AUTHORS
authorNames := []string{}
authorAddresses := make(map[string]string)

for _, author := range demo.Authors {
authors := strings.Split(author, ":")
authorNames = append(authorNames, authors[0])
authorAddresses[authors[0]] = authors[1]
}

values["authors"] = authorNames
values["authorAddresses"] = authorAddresses

// tmp
values["whatever"] = []string{"blabla", "this", "that"}
Expand All @@ -181,6 +195,9 @@ var pushCmd = &cobra.Command{
dt := time.Now()
return dt.Format("01-02-2006 15:04:05")
},
"getValueFromStringMap": func(key string, keyValues map[string]string) string {
return keyValues[key]
},

// "randomFromSlice": func(inputSlice []string) string {
// // Check if the slice is empty
Expand Down
13 changes: 8 additions & 5 deletions profiles/homerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ bodyTemplate: |
{
"System": "{{ .system }}",
"Severity": "{{ .severity }}"
"Author": "{{ random .authors }}",
{{ $author := random .authors }}
"Author": "{{ $author }}",
"Tags": "{{ random .authors }}",
"Timestamp": "{{ timestamp }}",
"AssigneeName": "{{ random .authors }}",
{{ $assignee := random .authors }}
"AssigneeName": "{{ $assignee }}",
"AssigneeAddress": "{{ getValueFromStringMap $assignee .authorAddresses }}",
}
authors:
- "tom"
- "mark"
- "travis"
- "mark:mark@blink182.com"
- "tom:tom@blink182.com"
- "travis:travis@blink182.com"

# preValues:
# git:
Expand Down

0 comments on commit 696a614

Please sign in to comment.