Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

GitHub API requests require a User-Agent header to avoid rate limiting and request rejection. The self-update command was making requests without this header.

Changes

  • Added User-Agent: journal-cli/{version} header to GitHub API requests:
    • Release metadata fetch from /repos/{owner}/{repo}/releases/latest
    • Binary asset download
  • Imported internal/version package to dynamically include version string

Implementation

req, err := http.NewRequest("GET", "https://api.github.com/repos/"+repo+"/releases/latest", nil)
if err != nil {
    return fmt.Errorf("failed to create request: %w", err)
}
req.Header.Set("User-Agent", "journal-cli/"+version.GetVersion())

resp, err := http.DefaultClient.Do(req)

The version string resolves to "dev" for development builds or the actual semantic version for releases.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ops295 <42335697+ops295@users.noreply.github.com>
Copilot AI changed the title [WIP] Update self-update command based on PR feedback Add User-Agent header to GitHub API requests in self-update Jan 7, 2026
Copilot AI requested a review from ops295 January 7, 2026 02:32
@ops295 ops295 marked this pull request as ready for review January 7, 2026 02:32
@ops295 ops295 merged commit c4fb724 into feature/self-update Jan 7, 2026
@ops295 ops295 deleted the copilot/sub-pr-5-one-more-time branch January 7, 2026 02:32
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