Skip to content

refactor(upgrade): use centralized user-agent for GitHub API requests#173

Merged
BYK merged 1 commit intomainfrom
refactor/centralize-user-agent
Feb 4, 2026
Merged

refactor(upgrade): use centralized user-agent for GitHub API requests#173
BYK merged 1 commit intomainfrom
refactor/centralize-user-agent

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 4, 2026

Summary

Replace hardcoded User-Agent: sentry-cli in the upgrade module with the centralized getUserAgent() function from constants.ts.

This ensures GitHub API requests (for version checks and releases) use the same descriptive user-agent format as Sentry API requests:

sentry-cli/0.5.0 (linux-x64) bun/1.3.3

Changes

  • Import getUserAgent() from constants.ts
  • Convert static GITHUB_HEADERS constant to getGitHubHeaders() function
  • Update fetchLatestFromGitHub() and versionExists() to use the new function

Closes: N/A

Cursor Bugbot reviewed your changes and found no issues for commit 6189f50

Replace hardcoded 'sentry-cli' user-agent string with getUserAgent() from constants.ts, which generates proper version and runtime info (e.g., 'sentry-cli/0.5.0 (linux-x64) bun/1.3.3').
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (dsn) Add project root detection for automatic DSN discovery by BYK in #159
  • (issue) Replace --org/--project flags with /ID syntax by BYK in #161
  • (telemetry) Add withTracing helper to reduce Sentry span boilerplate by BYK in #172

Bug Fixes 🐛

  • (types) Align schema types with Sentry API by betegon in #169
  • Added nullable in substatus's zod validation by MathurAditya724 in #157

Internal Changes 🔧

  • (upgrade) Use centralized user-agent for GitHub API requests by BYK in #173

Other

  • test: add model-based and property-based testing with fast-check by BYK in #166

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 2184 uncovered lines.
✅ Project coverage is 70.49%. Comparing base (base) to head (head).

Files with missing lines (34)
File Patch % Lines
human.ts 31.80% ⚠️ 684 Missing
resolve-target.ts 10.74% ⚠️ 291 Missing
oauth.ts 25.10% ⚠️ 194 Missing
upgrade.ts 40.23% ⚠️ 153 Missing
api-client.ts 74.21% ⚠️ 138 Missing
resolver.ts 3.23% ⚠️ 120 Missing
errors.ts 5.94% ⚠️ 95 Missing
migration.ts 47.44% ⚠️ 82 Missing
version-check.ts 34.04% ⚠️ 62 Missing
telemetry.ts 66.89% ⚠️ 50 Missing
api.ts 89.80% ⚠️ 47 Missing
seer.ts 75.54% ⚠️ 45 Missing
preload.ts 38.71% ⚠️ 38 Missing
seer.ts 79.87% ⚠️ 30 Missing
schema.ts 52.73% ⚠️ 26 Missing
utils.ts 87.43% ⚠️ 24 Missing
detector.ts 90.10% ⚠️ 20 Missing
code-scanner.ts 95.06% ⚠️ 16 Missing
project-root.ts 97.00% ⚠️ 11 Missing
fs-utils.ts 57.14% ⚠️ 9 Missing
auth.ts 94.78% ⚠️ 7 Missing
dsn-cache.ts 96.71% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
arg-parsing.ts 93.41% ⚠️ 6 Missing
upgrade.ts 93.83% ⚠️ 5 Missing
colors.ts 91.84% ⚠️ 4 Missing
env-file.ts 97.58% ⚠️ 3 Missing
sentry-urls.ts 88.00% ⚠️ 3 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
project-root-cache.ts 96.92% ⚠️ 2 Missing
alias.ts 99.28% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    70.49%    70.49%        —%
==========================================
  Files           54        54         —
  Lines         7400      7402        +2
  Branches         0         0         —
==========================================
+ Hits          5216      5218        +2
- Misses        2184      2184         —
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review February 4, 2026 23:17
@BYK BYK merged commit 199aacf into main Feb 4, 2026
26 checks passed
@BYK BYK deleted the refactor/centralize-user-agent branch February 4, 2026 23:22
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.

1 participant