Fixing Sentry release, “No commits found. Change commits range…”

When the getsentry/action-release GitHub action fails with “No commits found. Change commits range, initial depth or use — ignore-empty to allow empty patch sets.”

Charles Stover

--

My GitHub deployment workflow, when attempting to upload source maps to Sentry, recently failed with the following unhelpful error.

Error: Command failed: /action-release/dist/sentry-cli releases set-commits *** --auto
error: No commits found. Change commits range, initial depth or use --ignore-empty to allow empty patch sets.
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.

One would think GitHub could identify the commits range in the workflow, so why is it failing to find them? The suggestion to unblock this issue with --ignore-empty is bad advice, as the change set should not be empty in the first place. To resolve this, I followed the subsequent instructions and set my SENTRY_LOG_LEVEL environment variable to debug.

Once debug logs were enabled, I found that Sentry’s GitHub action was using the git history for a different repository altogether. I searched my repository for any references to the other, but found no results. I needed to determine why Sentry thought this workflow belonged to a different repository.

Prior to the logs mentioning the wrong repository, they included a network request to a Sentry API called /repos. I hit that API myself and found a list of GitHub repos in the response. Curiously, the repository triggering this workflow was not in that list; but the one Sentry was erroneously using in the debug logs was the first repository in the list. I concluded that the fix is to get this repository into Sentry’s API response, and that the fix therefore must live in Sentry itself.

Digging into Sentry’s settings, I found the organization’s Integrations configurations page under the Settings screen. Specifically of interest was the GitHub integration, which hopefully contained a list of supported repositories.

Sure enough, the GitHub configurations tab showed my organization’s GitHub account, which when configured showed the exact repository list in the API response. By selecting “Add repository,” I was able to enable Sentry on the new workflow.

Don’t forget to configure your Code Mappings for the repository!

Once the repository was added and re-running the jobs, Sentry published the new release without any problems. 🙏

Conclusion 🔚

If you have any questions, feedback, or relevant great advice, please leave it in the comments below.

To read more of my columns, you may follow me on LinkedIn and Twitter, or check out my portfolio on CharlesStover.com.

--

--