Skip to content

Commit

Permalink
fix(github): git event path (#114)
Browse files Browse the repository at this point in the history
* fix(github): git event path

* Update text

Co-authored-by: oranmoshai <oran.moshai@aquasec.com>
  • Loading branch information
oranmoshai and oranmoshai authored Jun 1, 2022
1 parent 8965191 commit 9e17a88
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions pkg/buildClient/comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ func prComments(buildSystem string, result []*buildsecurity.Result) error {
}

func returnSecretMsg(r *buildsecurity.Result) string {
return fmt.Sprintf("### :warning: Aqua found issue"+
"\n<b>CATEGORY:</b> %s "+
"\n<b>DESCRIPTION:</b> %s "+
"\n<b>SEVERITY:</b> %s "+
"\n<b>MATCH:</b> %s",
return fmt.Sprintf("### :warning: Aqua detected sensitive data in your code"+
"\n<b>Category:</b> %s "+
"\n<b>Description:</b> %s "+
"\n<b>Severity:</b> %s "+
"\n<b>Match:</b> %s",
r.Resource,
r.Title,
r.Severity.String(),
strings.ReplaceAll(r.Severity.String(), "SEVERITY_", ""),
r.Message)
}
func returnMisconfMsg(r *buildsecurity.Result) string {
return fmt.Sprintf("### :warning: Aqua found issue "+
"\n<b>MISCONF ID:</b> %s "+
"\n<b>CHECK:</b> %s "+
"\n<b>SEVERITY:</b> %s "+
"\n<b>MESSAGE:</b> %s",
return fmt.Sprintf("### :warning: Aqua detected misconfiguration in your code"+
"\n<b>Misconfiguration ID:</b> %s "+
"\n<b>Check Name:</b> %s "+
"\n<b>Severity:</b> %s "+
"\n<b>Message:</b> %s",
r.AVDID,
r.Title,
r.Severity.String(),
strings.ReplaceAll(r.Severity.String(), "SEVERITY_", ""),
r.Message)
}

Expand All @@ -104,7 +104,7 @@ func getGitHubRepositoryDetails() (owner, repo string, err error) {

// extractGitHubActionPrNumber take the pull request number from the GitHub action run
func extractGitHubActionPrNumber() (int, error) {
githubEventFile := "/github/workflow/event.json"
githubEventFile := os.Getenv("GITHUB_EVENT_PATH")
file, err := ioutil.ReadFile(githubEventFile)
if err != nil {
return 0, fmt.Errorf("failed gitHub event payload not found in %s", githubEventFile)
Expand Down
2 changes: 1 addition & 1 deletion pkg/buildClient/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (bc *TwirpClient) Upload(results []*buildsecurity.Result, tags map[string]s
}

// Send pull request comments
if triggeredBy == "pr" && len(results) > 0 {
if triggeredBy == "PR" && len(results) > 0 {
err = prComments(buildSystem, results)
if err != nil {
log.Logger.Info("failed send PR comment logging and continue the scan err: ", err)
Expand Down

0 comments on commit 9e17a88

Please sign in to comment.