possible fix for duplicating issues
All checks were successful
Gosec Check / Gosec Check (push) Successful in 50s
All checks were successful
Gosec Check / Gosec Check (push) Successful in 50s
This commit is contained in:
parent
f05f53499c
commit
b8c45e319c
1 changed files with 9 additions and 14 deletions
13
cmd/root.go
13
cmd/root.go
|
@ -193,6 +193,7 @@ var rootCmd = &cobra.Command{
|
||||||
repoOwner, repoName := actionCtx.Repo()
|
repoOwner, repoName := actionCtx.Repo()
|
||||||
|
|
||||||
issues, _, err := forgeClient.ListIssues(forgejo.ListIssueOption{
|
issues, _, err := forgeClient.ListIssues(forgejo.ListIssueOption{
|
||||||
|
State: forgejo.StateOpen,
|
||||||
ListOptions: forgejo.ListOptions{
|
ListOptions: forgejo.ListOptions{
|
||||||
Page: -1,
|
Page: -1,
|
||||||
},
|
},
|
||||||
|
@ -202,23 +203,18 @@ var rootCmd = &cobra.Command{
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
//god help me
|
|
||||||
pretty.Logln(issues)
|
|
||||||
|
|
||||||
isFound := false
|
|
||||||
for _, issue := range issues {
|
for _, issue := range issues {
|
||||||
if issue.Title == "GoSec Report" && actionCtx.Repository == issue.Repository.FullName {
|
if issue.Title == "GoSec Report" && repoOwner+"/"+repoName == issue.Repository.FullName {
|
||||||
isFound = true
|
pretty.Println(issue)
|
||||||
if _, _, err := forgeClient.EditIssue(repoOwner, repoName, issue.Index, forgejo.EditIssueOption{
|
if _, _, err := forgeClient.EditIssue(repoOwner, repoName, issue.Index, forgejo.EditIssueOption{
|
||||||
Body: &markdownOutputStr,
|
Body: &markdownOutputStr,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
break
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isFound {
|
|
||||||
if _, _, err := forgeClient.CreateIssue(repoOwner, repoName, forgejo.CreateIssueOption{
|
if _, _, err := forgeClient.CreateIssue(repoOwner, repoName, forgejo.CreateIssueOption{
|
||||||
Title: "GoSec Report",
|
Title: "GoSec Report",
|
||||||
Body: markdownOutputStr,
|
Body: markdownOutputStr,
|
||||||
|
@ -226,7 +222,6 @@ var rootCmd = &cobra.Command{
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue