You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 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%
# Associate commits via repository integration (needs local git checkout)
103
+
sentry release set-commits my-org/1.0.0 --auto
104
+
105
+
# Or read commits from local git history (no integration needed)
106
+
sentry release set-commits my-org/1.0.0 --local
107
+
108
+
# Mark the release as finalized
109
+
sentry release finalize my-org/1.0.0
110
+
111
+
# Record a production deploy
112
+
sentry release deploy my-org/1.0.0 production
113
+
```
114
+
115
+
**Key details:**
116
+
- The positional is `<org-slug>/<version>`. In `sentry release create sentry/1.0.0`, `sentry` is the org and `1.0.0` is the version — the slash separates org from version, it is not part of the version string.
117
+
- The **version** must match the `release` value in `Sentry.init()`. If your SDK uses `"1.0.0"`, the command must use `org/1.0.0`.
118
+
-`--auto` requires a Sentry repository integration (GitHub/GitLab/Bitbucket) **and** a local git checkout. It matches your `origin` remote against Sentry's repo list. Without a checkout, use `--local`.
119
+
- With no flag, `set-commits` tries `--auto` first and falls back to `--local` on failure.
120
+
96
121
### Arbitrary API Access
97
122
98
123
```bash
@@ -183,38 +208,6 @@ sentry span list my-org/my-project/abc123def456...
183
208
184
209
When querying the Events API (directly or via `sentry api`), valid dataset values are: `spans`, `transactions`, `logs`, `errors`, `discover`.
185
210
186
-
## Release Workflow
187
-
188
-
The `sentry release` command group manages Sentry releases for tracking deploys and associating commits with errors. A typical CI workflow:
189
-
190
-
```bash
191
-
# Create a release (version must match Sentry.init() release value)
# Associate commits via repository integration (requires git checkout)
195
-
sentry release set-commits my-org/1.0.0 --auto
196
-
197
-
# Mark the release as finalized
198
-
sentry release finalize my-org/1.0.0
199
-
200
-
# Record a deploy
201
-
sentry release deploy my-org/1.0.0 production
202
-
```
203
-
204
-
**Key details:**
205
-
206
-
- The `org/version` positional is `<org-slug>/<version>`, NOT a version prefix. `sentry release create sentry/1.0.0` means org=`sentry`, version=`1.0.0`. This is how org is specified — not via `SENTRY_ORG`.
207
-
- The release **version** (e.g., `1.0.0`) must match the `release` value in your `Sentry.init()` call. If your SDK uses bare semver, the release must be bare semver too.
208
-
-`--auto` requires **both** a Sentry repository integration (GitHub/GitLab/Bitbucket) **and** a local git checkout. It lists repos from the API and matches against your local `origin` remote URL, then sends the HEAD commit SHA. Without a checkout, use `--local` instead.
209
-
- When neither `--auto` nor `--local` is specified, the CLI tries `--auto` first and falls back to `--local` on failure.
210
-
211
-
### CI/CD Setup Notes
212
-
213
-
- The `sentry` npm package requires **Node.js >= 22**. CI runners like `ubuntu-latest` ship Node.js 20 — add `actions/setup-node@v6` with `node-version: 22`.
214
-
- If `SENTRY_AUTH_TOKEN` is scoped to a GitHub environment (e.g., `production`), set `environment: production` on the job.
215
-
- A full git checkout (`fetch-depth: 0`) is needed for `--auto` to discover the remote URL and HEAD.
216
-
-`set-commits --auto` has `continue-on-error` in most workflows because it requires a working repository integration. If the integration isn't configured, the step fails but the rest of the release workflow succeeds.
217
-
218
211
## Common Mistakes
219
212
220
213
-**Wrong issue ID format**: Use `PROJECT-123` (short ID), not the numeric ID `123456789`. The short ID includes the project prefix.
@@ -200,7 +200,6 @@ sentry release deploy my-org/1.0.0 production
200
200
## Important Notes
201
201
202
202
-**Version matching**: The release version must match the `release` value in your `Sentry.init()` call. If your SDK uses `"1.0.0"`, create the release as `sentry release create org/1.0.0` (version = `1.0.0`), **not**`sentry release create org/myapp/1.0.0`.
203
-
-**The `org/` prefix is the org slug**: In `sentry release create sentry/1.0.0`, `sentry` is the org slug and `1.0.0` is the version. The `/` separates org from version, it's not part of the version string.
204
-
-**`--auto` needs a git checkout**: The `--auto` flag lists repos from the Sentry API and matches against your local `origin` remote URL. A full checkout (`git fetch-depth: 0`) is needed for `--auto` to work. Without a checkout, use `--local`.
205
-
-**Default mode tries `--auto` first**: When neither `--auto` nor `--local` is specified, the CLI tries auto-discovery first and falls back to local git history if the integration isn't configured.
206
-
-**Node.js >= 22 required**: The `sentry` npm package requires Node.js 22 or later. CI runners like `ubuntu-latest` ship Node.js 20 by default.
203
+
-**The `org/` prefix is the org slug**: In `sentry release create sentry/1.0.0`, `sentry` is the org slug and `1.0.0` is the version. The `/` separates org from version — it is not part of the version string.
204
+
-**`--auto` needs a git checkout**: The `--auto` flag lists repos from the Sentry API and matches against your local `origin` remote URL. Without a local git repo, use `--local` instead.
205
+
-**Default mode tries `--auto` first**: When neither `--auto` nor `--local` is specified, `set-commits` tries auto-discovery first and falls back to local git history if the integration isn't configured.
# Associate commits via repository integration (needs local git checkout)
113
+
sentry release set-commits my-org/1.0.0 --auto
114
+
115
+
# Or read commits from local git history (no integration needed)
116
+
sentry release set-commits my-org/1.0.0 --local
117
+
118
+
# Mark the release as finalized
119
+
sentry release finalize my-org/1.0.0
120
+
121
+
# Record a production deploy
122
+
sentry release deploy my-org/1.0.0 production
123
+
```
124
+
125
+
**Key details:**
126
+
- The positional is `<org-slug>/<version>`. In `sentry release create sentry/1.0.0`, `sentry` is the org and `1.0.0` is the version — the slash separates org from version, it is not part of the version string.
127
+
- The **version** must match the `release` value in `Sentry.init()`. If your SDK uses `"1.0.0"`, the command must use `org/1.0.0`.
128
+
-`--auto` requires a Sentry repository integration (GitHub/GitLab/Bitbucket) **and** a local git checkout. It matches your `origin` remote against Sentry's repo list. Without a checkout, use `--local`.
129
+
- With no flag, `set-commits` tries `--auto` first and falls back to `--local` on failure.
130
+
106
131
#### Arbitrary API Access
107
132
108
133
```bash
@@ -193,38 +218,6 @@ sentry span list my-org/my-project/abc123def456...
193
218
194
219
When querying the Events API (directly or via `sentry api`), valid dataset values are: `spans`, `transactions`, `logs`, `errors`, `discover`.
195
220
196
-
### Release Workflow
197
-
198
-
The `sentry release` command group manages Sentry releases for tracking deploys and associating commits with errors. A typical CI workflow:
199
-
200
-
```bash
201
-
# Create a release (version must match Sentry.init() release value)
# Associate commits via repository integration (requires git checkout)
205
-
sentry release set-commits my-org/1.0.0 --auto
206
-
207
-
# Mark the release as finalized
208
-
sentry release finalize my-org/1.0.0
209
-
210
-
# Record a deploy
211
-
sentry release deploy my-org/1.0.0 production
212
-
```
213
-
214
-
**Key details:**
215
-
216
-
- The `org/version` positional is `<org-slug>/<version>`, NOT a version prefix. `sentry release create sentry/1.0.0` means org=`sentry`, version=`1.0.0`. This is how org is specified — not via `SENTRY_ORG`.
217
-
- The release **version** (e.g., `1.0.0`) must match the `release` value in your `Sentry.init()` call. If your SDK uses bare semver, the release must be bare semver too.
218
-
-`--auto` requires **both** a Sentry repository integration (GitHub/GitLab/Bitbucket) **and** a local git checkout. It lists repos from the API and matches against your local `origin` remote URL, then sends the HEAD commit SHA. Without a checkout, use `--local` instead.
219
-
- When neither `--auto` nor `--local` is specified, the CLI tries `--auto` first and falls back to `--local` on failure.
220
-
221
-
#### CI/CD Setup Notes
222
-
223
-
- The `sentry` npm package requires **Node.js >= 22**. CI runners like `ubuntu-latest` ship Node.js 20 — add `actions/setup-node@v6` with `node-version: 22`.
224
-
- If `SENTRY_AUTH_TOKEN` is scoped to a GitHub environment (e.g., `production`), set `environment: production` on the job.
225
-
- A full git checkout (`fetch-depth: 0`) is needed for `--auto` to discover the remote URL and HEAD.
226
-
-`set-commits --auto` has `continue-on-error` in most workflows because it requires a working repository integration. If the integration isn't configured, the step fails but the rest of the release workflow succeeds.
227
-
228
221
### Common Mistakes
229
222
230
223
-**Wrong issue ID format**: Use `PROJECT-123` (short ID), not the numeric ID `123456789`. The short ID includes the project prefix.
0 commit comments