feat: add Vikunja handler to main file
Co-authored-by: aider (openai/qwen2.5-coder:32b-instruct-q4_0) <aider@aider.chat>
This commit is contained in:
parent
1f36c2ef9f
commit
ebd45dfff5
1 changed files with 34 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"o5r.ca/autocrossbow/contributions"
|
"o5r.ca/autocrossbow/contributions"
|
||||||
|
"o5r.ca/autocrossbow/issues/vikunja"
|
||||||
"o5r.ca/autocrossbow/issues"
|
"o5r.ca/autocrossbow/issues"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -18,7 +19,8 @@ func main() {
|
||||||
employeename := os.Args[5]
|
employeename := os.Args[5]
|
||||||
prs := DoPrs(proj, ghusername, start, end)
|
prs := DoPrs(proj, ghusername, start, end)
|
||||||
issues := DoJira(start, end)
|
issues := DoJira(start, end)
|
||||||
summ, err := SummarizeData(employeename, prs, issues)
|
vikunjaTasks := DoVikunja(start, end)
|
||||||
|
summ, err := SummarizeData(employeename, prs, issues, vikunjaTasks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(fmt.Errorf("error getting PRs: %w", err))
|
fmt.Println(fmt.Errorf("error getting PRs: %w", err))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
@ -57,17 +59,43 @@ func DoJira(start, end string) []issues.Issue {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
ghf, err := os.Create(fmt.Sprintf("jira-%s-%s-%s-%s-%d.json", host, user, start, end, time.Now().Unix()))
|
jf, err := os.Create(fmt.Sprintf("jira-%s-%s-%s-%s-%d.json", host, user, start, end, time.Now().Unix()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(fmt.Errorf("error creating PR file: %w", err))
|
fmt.Println(fmt.Errorf("error creating JIRA file: %w", err))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
||||||
}
|
}
|
||||||
enc := json.NewEncoder(ghf)
|
defer jf.Close()
|
||||||
|
|
||||||
|
enc := json.NewEncoder(jf)
|
||||||
err = enc.Encode(issues)
|
err = enc.Encode(issues)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(fmt.Errorf("error writing out PRs: %w", err))
|
fmt.Println(fmt.Errorf("error writing out JIRA issues: %w", err))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
return issues
|
return issues
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DoVikunja(start, end string) []vikunja.Task {
|
||||||
|
host := os.Getenv("VIKUNJA_HOST")
|
||||||
|
user := os.Getenv("VIKUNJA_USER")
|
||||||
|
tasks, err := vikunja.GetTasks(host, user, start, end)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(fmt.Errorf("error getting Vikunja tasks: %w", err))
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
vf, err := os.Create(fmt.Sprintf("vikunja-%s-%s-%s-%s-%d.json", host, user, start, end, time.Now().Unix()))
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(fmt.Errorf("error creating Vikunja file: %w", err))
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
defer vf.Close()
|
||||||
|
|
||||||
|
enc := json.NewEncoder(vf)
|
||||||
|
err = enc.Encode(tasks)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(fmt.Errorf("error writing out Vikunja tasks: %w", err))
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return tasks
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue