From c7ad8ae3230f715df143075b38a560607a24bea2 Mon Sep 17 00:00:00 2001 From: Shane C Date: Fri, 6 Sep 2024 17:33:50 -0400 Subject: [PATCH] log cwd to see if anything is going wrong --- .actrc | 3 +++ cmd/root.go | 14 ++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 .actrc diff --git a/.actrc b/.actrc new file mode 100644 index 0000000..67c6f48 --- /dev/null +++ b/.actrc @@ -0,0 +1,3 @@ +--github-instance git.shadowhosting.xyz +-W ./.forgejo/workflows +-P node20-bookworm=node:20-bookworm \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index c44f716..37b647f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -36,6 +36,8 @@ var rootCmd = &cobra.Command{ log.Fatalln(err) } + pretty.Logln(cwd) + repo, err := git.PlainOpen(cwd) if err != nil { log.Fatalln(err) @@ -146,9 +148,6 @@ var rootCmd = &cobra.Command{ markdownHandler.PlainText(fmt.Sprintf("🟨 **%d** low severity issues\n", sevCountMap["low"])) } markdownHandler.PlainTextf("Total of **%d** issues.\n", sevCountMap["high"]+sevCountMap["medium"]+sevCountMap["low"]) - } - - if len(rows) != 0 { markdownHandler.CustomTable(markdown.TableSet{ Header: []string{"Rule", "Severity", "Confidence", "Location"}, Rows: rows, @@ -205,13 +204,8 @@ var rootCmd = &cobra.Command{ } } else { for _, issue := range issues { - pretty.Logln(issue) - if issue.Title == "GoSec Report" && strings.Contains(issue.Body, "GoSec Report:") { - issueID, err := strconv.Atoi(string(issue.HTMLURL[len(issue.HTMLURL)-1])) - if err != nil { - log.Fatalln(err) - } - if _, _, err := forgeClient.EditIssue(repoOwner, repoName, int64(issueID), forgejo.EditIssueOption{ + if issue.Title == "GoSec Report" && strings.Contains(issue.Body, "GoSec Report:") && actionCtx.Repository == issue.Repository.FullName { + if _, _, err := forgeClient.EditIssue(repoOwner, repoName, issue.Index, forgejo.EditIssueOption{ Body: &markdownOutputStr, }); err != nil { log.Fatalln(err)