Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-JIRA: Fix issue with release note tool #3429

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix issue with release note tool.
Add support for a token to avoid 403 errors.  Add a more clear error
message and return on error in release note tool.
  • Loading branch information
imain committed Jan 23, 2024
commit 40c8f73588c04733b948e57b958fd9ce7bfe2898
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ clients:

.PHONY: release
release:
go run ./hack/tools/release/notes.go --from=${FROM} --to=${TO}
go run ./hack/tools/release/notes.go --from=${FROM} --to=${TO} --token=${TOKEN}

.PHONY: app-sre-saas-template
app-sre-saas-template: hypershift
Expand Down Expand Up @@ -265,4 +265,4 @@ ci-test-e2e:
.PHONY: regenerate-pki
regenerate-pki:
REGENERATE_PKI=1 $(GO) test ./control-plane-pki-operator/...
REGENERATE_PKI=1 $(GO) test ./test/e2e/... -run TestRegeneratePKI
REGENERATE_PKI=1 $(GO) test ./test/e2e/... -run TestRegeneratePKI
10 changes: 8 additions & 2 deletions hack/tools/release/notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type commit struct {
var (
fromTag = flag.String("from", "", "The tag or commit to start from.")
toTag = flag.String("to", "", "The tag or commit to compare with.")
token = flag.String("token", "", "The token to use for github API authorization.")
)

func main() {
Expand Down Expand Up @@ -82,16 +83,21 @@ func main() {
headers := map[string]string{
"Accept": "application/vnd.github.v3+json",
}
if token != nil && *token != "" {
headers["Authorization"] = fmt.Sprintf("Bearer %s", *token)
}

// Make the API request.
resp, err := makeRequest("GET", url, headers, nil)
if err != nil {
fmt.Printf("Error making API request: %v", err)
return
os.Exit(1)
}

if resp.StatusCode != 200 {
fmt.Println(fmt.Sprintf("API returned: %v", resp.StatusCode))
fmt.Println(fmt.Sprintf("API returned: %v. Changelog incomplete!", resp.StatusCode))
fmt.Println("Consider generating an authorization token and using the --token flag.")
os.Exit(1)
}

// Parse the API response body.
Expand Down