Skip to content

fix(ci): fix set-commits --auto and add checkout/URL to sentry-release workflow#649

Merged
BYK merged 6 commits intomainfrom
fix/sentry-release-org
Apr 2, 2026
Merged

fix(ci): fix set-commits --auto and add checkout/URL to sentry-release workflow#649
BYK merged 6 commits intomainfrom
fix/sentry-release-org

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 2, 2026

Summary

Fixes two issues from the latest sentry-release run:

  1. set-commits --auto sent bogus refs: [{repository: "auto", commit: "auto"}] — the API rejects "auto" as a repository name. The fix rewrites setCommitsAuto to properly list the org's repos, match against the local git remote, and send real refs with the HEAD SHA.

  2. Workflow had no checkout--auto needs a local git repo to discover the remote URL and HEAD. Added actions/checkout with fetch-depth: 0.

Also adds --url to the release create step pointing to the GitHub release page.

Changes

src/lib/api/releases.ts

  • setCommitsAuto now lists org repos → matches local git remote → sends real refs with HEAD SHA
  • New deps: listRepositories, getRepositoryName, getHeadCommit, ApiError

src/commands/release/set-commits.ts

  • Pass cwd through to setCommitsAuto in both the --auto and default code paths

.github/workflows/sentry-release.yml

  • Add actions/checkout@v6 with fetch-depth: 0
  • Add --url to release create pointing to the GitHub release page

Tests

  • Move setCommitsAuto test to test/isolated/set-commits-auto.test.ts (requires mock.module for git helpers)
  • Tests verify: repo listing → remote matching → HEAD discovery → refs payload, and the no-repos error case

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 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).


Bug Fixes 🐛

  • (ci) Fix set-commits --auto and add checkout/URL to sentry-release workflow by BYK in #649
  • (upgrade) Add blank lines around changelog in upgrade output by BYK in #642

Internal Changes 🔧

  • Restore sentry/ org prefix in sentry-release workflow by BYK in #648
  • Use production environment for sentry-release auth token by BYK in #645
  • Fix sentry-release workflow Node.js version and add manual trigger by BYK in #643
  • Regenerate skill files and command docs by github-actions[bot] in 59c820e4

🤖 This preview updates automatically when you update the PR.

@BYK BYK force-pushed the fix/sentry-release-org branch from 6c05df1 to ed5daec Compare April 2, 2026 20:08
- 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)
@BYK BYK force-pushed the fix/sentry-release-org branch from ed5daec to 72c425e Compare April 2, 2026 20:10
- 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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

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

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

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)
BYK and others added 3 commits April 2, 2026 20:35
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%
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/pr-preview/pr-649/

Built to branch gh-pages at 2026-04-02 20:58 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@BYK BYK merged commit 3142276 into main Apr 2, 2026
27 checks passed
@BYK BYK deleted the fix/sentry-release-org branch April 2, 2026 21:11
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%
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