Deployment event fails when ref is a tag

I’m testing out the github deployment api integration, and our deployment model is to tag the repo and then create a new deployment with the API.

If I try this, my clone task fails because drone tries to checkout /refs/heads/TAG, which is not valid.

1 Like

Didn’t find any newer topic about this so I’m bumping it :slight_smile: I’ve just got the same issue. The deployment event sends this:

    "sha": "3ef...",
    "ref": "1.0.0",

And then Drone tries to:

+ git fetch --no-tags origin +refs/heads/1.0.0:
fatal: Couldn't find remote ref refs/heads/1.0.0

Wouldn’t it be possible, in case of a deployment event, to use “sha” instead of “ref” when cloning? This works:

git fetch 3ef...

Didn’t look at the code to see how its handled though.

1 Like

Trying to deploy a commit ref does not work either… the fetch does not actually fetch the ref, but fetched the master instead:

+ git fetch --no-tags origin +refs/heads/master:
...
+ git reset --hard -q 3ef...
fatal: Could not parse object '3ef....

Although the webhook sent the ref correctly:

    "sha": "3ef...",
    "ref": "3ef...",

And the ref “3ef…” is not even in the master branch. Probably somewhere in the clone logic it decided to get the default branch instead.