Skip to content

Add UserAgent#3

Merged
sue445 merged 1 commit into
mainfrom
feature/user_agent
Apr 11, 2026
Merged

Add UserAgent#3
sue445 merged 1 commit into
mainfrom
feature/user_agent

Conversation

@sue445

@sue445 sue445 commented Apr 11, 2026

Copy link
Copy Markdown
Owner

No description provided.

@sue445 sue445 requested a review from Copilot April 11, 2026 08:22
@sue445 sue445 marked this pull request as ready for review April 11, 2026 08:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds configurable User-Agent support to the GitHub API client initialization, enabling callers (including GitHub Enterprise users) to control the User-Agent header while still providing a sensible default.

Changes:

  • Extend ClientParams with a UserAgent field.
  • Set the go-github client UserAgent during NewClient construction (defaulting when empty).
  • Introduce a default User-Agent generator helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client.go
Comment on lines +107 to +110
// GetDefaultUserAgent returns the default User-Agent.
func GetDefaultUserAgent() string {
return fmt.Sprintf("ghrcooldown/%s (+https://github.com/sue445/ghrcooldown)", Version)
}
Comment thread client.go
Comment on lines +42 to +46
if params.UserAgent == "" {
client.UserAgent = GetDefaultUserAgent()
} else {
client.UserAgent = params.UserAgent
}
@sue445 sue445 merged commit 61ea166 into main Apr 11, 2026
10 checks passed
@sue445 sue445 deleted the feature/user_agent branch April 11, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants