fix(ci): fix set-commits --auto and add checkout/URL to sentry-release workflow#649
Merged
fix(ci): fix set-commits --auto and add checkout/URL to sentry-release workflow#649
Conversation
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
6c05df1 to
ed5daec
Compare
- Add actions/checkout with fetch-depth: 0 so set-commits --auto can
discover the git remote and HEAD commit
- Add --url pointing to the GitHub release page
- Fix setCommitsAuto: list org repos, match against local git remote,
send real refs with HEAD SHA instead of bogus {repository: 'auto'}
- Pass cwd through to setCommitsAuto from the command layer
- Move setCommitsAuto test to test/isolated/ (requires mock.module)
ed5daec to
72c425e
Compare
- Fix ApiError constructor: pass endpoint as 4th arg, not 3rd (detail) - Use ValidationError for local git failures (no remote, no matching repo) to avoid incorrect negative caching of repo integration status - Add missing await on expect().rejects.toThrow() in isolated test
Contributor
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1372 uncovered lines. Generated by Codecov Action |
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…ut@v6 - Catch ValidationError in setCommitsDefault to fall back to local git when auto-discovery fails (no local remote or no matching Sentry repo) - Fix actions/checkout@v7 → v6 (v7 doesn't exist yet)
Use listRepositoriesPaginated with early-exit loop instead of listRepositories (single page). Stops as soon as a matching repo is found to avoid unnecessary API calls.
- Add Release Workflow section to agent-guidance.md with CI/CD setup notes - Add Common Mistakes entries for version mismatch and --auto without checkout - Add Important Notes section to release.md command docs - Clarify org/version positional and --url in create.ts help text - Clarify --auto requirements in set-commits.ts help text - Add inline comments to sentry-release.yml documenting each pitfall - Regenerate SKILL.md and reference files - Add tests: --auto cwd pass-through, ValidationError fallback in default mode, multi-page repo pagination, no-match error, no-remote error - Patch coverage: releases.ts 99%, set-commits.ts 75%
Contributor
|
5 tasks
BYK
added a commit
that referenced
this pull request
Apr 3, 2026
## Summary Fixes `set-commits --auto` to properly discover commits and documents release workflow pitfalls learned from shipping the sentry-release CI workflow. Continuation of #643, #645, #648, #649 (all merged). ## Changes ### `set-commits --auto` rewrite (`src/lib/api/releases.ts`) - **Replace bogus `{repository: "auto", commit: "auto"}`** — list org repos via paginated API, match against local git remote, send real refs with HEAD SHA - **Fetch previous release commit** via `/previous-with-commits/` endpoint so Sentry can compute the commit range (without this, 0 commits are reported) - **Paginate** through all org repos with early-exit (`listRepositoriesPaginated`) - Use `ApiError` for no-repos (correct negative caching), `ValidationError` for local git failures - Fix `ApiError` constructor: `endpoint` as 4th arg, not 3rd ### Fallback fix (`src/commands/release/set-commits.ts`) - Catch `ValidationError` in `setCommitsDefault` → fall back to local git history ### Workflow fixes (`.github/workflows/sentry-release.yml`) - `actions/checkout@v6` with `fetch-depth: 0` (needed for `--auto` git discovery) - Move `--url` from `release create` to `release deploy` (URL belongs on the deploy) - Inline comments documenting every pitfall (Node.js version, env scoping, org prefix) ### Documentation - **agent-guidance.md**: New "Release Workflow" section with CI/CD setup notes; new Common Mistakes for version mismatch and `--auto` without checkout - **release.md**: CI workflow example + "Important Notes" section - **create.ts help**: Clarifies `org/version` positional format and version matching - **set-commits.ts help**: Clarifies `--auto` requires git checkout; documents default fallback behavior - Regenerated SKILL.md + reference files ### Tests - Isolated tests: repo discovery, pagination, no-match, no-repos, no-remote, previous commit fetch - Command tests: `--auto` cwd pass-through, `ValidationError` fallback in default mode - Patch coverage: `releases.ts` ~99%, `set-commits.ts` ~75%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes two issues from the latest sentry-release run:
set-commits --autosent bogusrefs: [{repository: "auto", commit: "auto"}]— the API rejects"auto"as a repository name. The fix rewritessetCommitsAutoto properly list the org's repos, match against the local git remote, and send real refs with the HEAD SHA.Workflow had no checkout —
--autoneeds a local git repo to discover the remote URL and HEAD. Addedactions/checkoutwithfetch-depth: 0.Also adds
--urlto therelease createstep pointing to the GitHub release page.Changes
src/lib/api/releases.tssetCommitsAutonow lists org repos → matches local git remote → sends real refs with HEAD SHAlistRepositories,getRepositoryName,getHeadCommit,ApiErrorsrc/commands/release/set-commits.tscwdthrough tosetCommitsAutoin both the--autoand default code paths.github/workflows/sentry-release.ymlactions/checkout@v6withfetch-depth: 0--urltorelease createpointing to the GitHub release pageTests
setCommitsAutotest totest/isolated/set-commits-auto.test.ts(requiresmock.modulefor git helpers)