How to associate commit to releases automatically with git tags?

I am wondering if sentry could look up commits of my current release automatically, if my release name is exactly the tag name of commit?

I’ve wrote such script for doing that:

# get the version name to create tag
VERSION=v$(node scripts/get-version.js)
git tag -a $VERSION
git push origin $VERSION
# sentry part
yarn sentry-cli releases new "$VERSION"
yarn sentry-cli releases set-commits --auto "$VERSION"
yarn sentry-cli releases files "$VERSION" upload-sourcemaps dist --no-rewrite
yarn sentry-cli releases finalize "$VERSION"

But I get below error mail after running the script:

Unable to Fetch Commits

We were unable to fetch the commit log for your release ( *VERSION* ) due to the following error:

GitHub returned a 404 Not Found error. If this repository exists, ensure that your installation has permission to access this repository

I dont recall the specifics of what sentry-cli passes to our endpoints, but theres a ‘ref’ param which works on any git ref (so tag, branch, sha). Ill see if someone closer to the cli can comment.

1 Like