action-release: Could not find the SHA of the previous release

When I used the following:

sentry_release:
  name: Create Sentry release
  needs: [ test_js, test_py ]
  runs-on: ubuntu-latest
  if: github.ref == 'refs/heads/master'
  steps:
    - uses: actions/checkout@v2
    - name: Create Sentry release
      uses: getsentry/action-release@v1
      env:
        SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
        SENTRY_ORG: ${{ env.ORG }}
        SENTRY_PROJECT: ${{ env.SENTRY_PROJECT }}
      with:
        environment: prod

I got the following error:

error: Could not find the SHA of the previous release in the git history. Increase your git clone depth.

It wasn’t clear obvious what to do right away, so I’m wondering if, in the documentation/README, it would be better to change the checkout step to following and add a note about why it’s necessary.

- uses: actions/checkout@v2
  with:
    fetch-depth: 0

This is what solved it for me. I also wasn’t sure if I should use something other than zero because in Github’s docs it’s not clear what other numbers do.

I’m happy to make a PR for the README if this sounds good or please go ahead and just change it if you want.

Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 16

Commits related to this issue

Most upvoted comments

Hi, I am getting the same error even after adding fetch-depth: 0 at the new repository. Any solution?

- uses: actions/checkout@v2
  with:
    fetch-depth: 0
- name: Create Sentry release
  uses: getsentry/action-release@v1
  env:
    SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
    SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
    SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  with:
    environment: production

I have the same issue, I created a release from a feature branch, then squashed the commits, and then the merge to master created a new release. The release creation on master fails with Could not find the SHA of the previous release in the git history..

This case is mentioned in the documentation: https://docs.sentry.io/product/cli/releases/#dealing-with-missing-commits. Probably it would be nice to add the ignore-missing flag to the parameters of the action.

In case anyone else is experiencing this still, our team found it was due to using git rebase.

@NisanthanNanthakumar could you add the ignore-missing flag?

Can confirm fetch-depth: 0 is no longer resolving error: Could not find the SHA of the previous release in the git history. Increase your git clone depth.

Actually my issue was I didn’t have the Sentry <-> GitHub integration configured correctly