Hi,
We’re facing some issues while trying to work with the pull_request event (drone v0.5)
There’s a merge when the branch is fetched, and we end up with files from the master branch in the build environment.
Is it done on purpose? If yes, why? Is there a way to avoid this behaviour?
To exclude any cache issue, we reproduced the problem in local by running the commands run by drone, one by one such as:
git init
git remote add origin https://github.com/...
git fetch --no-tags origin +refs/pull/7/merge:
git checkout -qf FETCH_HEAD
Is it done on purpose
Drone uses the merge ref. The merge ref is created by github and merges your pull request into the target branch. So it is done on purpose.
Is there a way to avoid this behaviour?
Yes, you can configure the default clone behavior to use the head ref instead of the merge ref. You can also completely customize and override the clone logic with your own custom commands. These feature are only available in the newer versions of drone, however.
Also note that the default clone logic has changed since 0.5 and now looks like this:
+ git remote add origin https://github.com/drone/drone.git
+ git reset --hard -q 1db7bde877325829d4dc77d9ac5b0248820e6620
+ git submodule update --init --recursive
Because 0.5 is end of life I definitely recommend planning on upgrading so you can take advantage of the newest platform features.
1 Like