Skip to content

Commit

Permalink
Add extra check in ids to bypass validations (#901)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncaak committed Feb 14, 2024
1 parent d67d308 commit a692346
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .snyk
@@ -0,0 +1,7 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
ignore: {}
patch: {}
exclude:
global:
- vendor
17 changes: 12 additions & 5 deletions cmd/changelog/main.go
Expand Up @@ -243,12 +243,19 @@ func getChanges(pullRequestIds, pullRequestHashes []string) []*Change {
var changes []*Change
log.Print("Reading changes from the GitHub API")
for i, id := range pullRequestIds {
change := getPullRequestFromGitHub(id)
change.hash = pullRequestHashes[i]
if _, err := determineReleases(change); err != nil {
continue
// This regex checks that the ids passed as CLI arguments are valid.
// This code cannot be encapsulated or Snyk will flag it as a defect.
// This warning was originally raised in issue OCPBUGS-26937.
if regexp.MustCompile(`^\d*$`).MatchString(id) {
change := getPullRequestFromGitHub(id)
change.hash = pullRequestHashes[i]
if _, err := determineReleases(change); err != nil {
continue
}
changes = append(changes, change)
} else {
log.Print("ERR :: could not validate entered Pull Request, ", id)
}
changes = append(changes, change)
}
return changes
}
Expand Down

0 comments on commit a692346

Please sign in to comment.