Deploy a PR build fails


I’ve got everything working as expected, except I cannot deploy from a PR. Steps to reproduce:

  1. Create a branch off master. Add a change. Commit and push to GH.
  2. Create a PR on GH.
  3. Assuming the PR build succeeds, promote it to deploy that build to an environment:
deploy username/repo build environment

I expect the latest commit in the PR to be deployed but I get this error instead:

+ git init
Initialized empty Git repository in /drone/src/
+ git remote add origin
+ git fetch --no-tags origin +refs/pull/1/merge:
 * branch            refs/pull/1/merge -> FETCH_HEAD
+ git reset --hard -q 1c5d042a0d3ac08b609344f9a246ec6f11d7cf13
fatal: Could not parse object '1c5d042a0d3ac08b609344f9a246ec6f11d7cf13'.
exit status 128

The clone task at the beginning of the pipeline is not finding the correct commit. I assume the git reset works differently with PR refs. It’s not a race condition, the deployment fails repeatedly. Any advice or help?

Drone project
Github project


    image: alpine
    - echo $${SECRET}
    secrets: [ secret ]
    image: alpine
    - echo $${SECRET}
    secrets: [ secret ]
      event: deployment

Please ensure you read the section about using secrets with pull requests:

You can also see this guide for common problems with secrets:

If you continue to experience issues with secrets, please provide all of the information requested here:

hi, the secrets mentioned in the drone file have nothing to do with the problem. It’s a red herring. I thought as I posted it that it might be confusing…

Would it not work in all cases to git checkout FETCH_HEAD instead of git reset --hard -q commit?