Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Fixed the PR number issue.
Browse files Browse the repository at this point in the history
Signed-off-by: naveensrinivasan <[email protected]>
  • Loading branch information
naveensrinivasan committed Jun 7, 2023
1 parent 05afea0 commit d4bfce3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,30 @@ import (
"log"
"net/http"
"os"
"regexp"
"strconv"
"strings"

"github.com/google/go-github/v46/github"
"golang.org/x/oauth2"
)

func extractPRNumber(ref string) string {
re := regexp.MustCompile(`refs/pull/(\d+)/merge`)
matches := re.FindStringSubmatch(ref)
if len(matches) > 1 {
return matches[1]
}
return ""
}
func main() {
vulnerabilities := ""
result := ""

repo := os.Getenv("GITHUB_REPOSITORY")
commitSHA := os.Getenv("GITHUB_SHA")
token := os.Getenv("GITHUB_TOKEN")
ref := os.Getenv("GITHUB_REF")
pr := strings.TrimPrefix(ref, "refs/pull/")
pr := extractPRNumber(os.Getenv("GITHUB_REF"))
ghUser := os.Getenv("GITHUB_ACTOR")
fileName := os.Getenv("SCORECARD_CHECKS")
if err := Validate(token, repo, commitSHA, pr); err != nil {
Expand Down

0 comments on commit d4bfce3

Please sign in to comment.