GitLab w/DRONE_COMMIT_BEFORE Variable

Hello,

I am trying to get the SHA Commit of my PR in my pipeline once I merge with the env variable DRONE_COMMIT_BEFORE however I am not having any luck and unsure if this is possible. Here is my pipeline process:

  1. Push change to branch repo
  2. Create Merge Request
  3. Pipeline kicks off, builds artifacts, stores artifacts externally to a folder that uses the DRONE_COMMIT sha in its name.
  4. Once pipeline succeeds, merge to master.
  5. This kicks off another pipeline that will do a copy of the contents from the prior SHA folder name.

Right now, I am trying to do this by using the variable DRONE_COMMIT_BEFORE which I believe should give me this information however when I echo it in my pipeline the variable is empty. Is there a way I can accomplish this?

Thanks again for all of the help.

the DRONE_COMMIT_BEFORE environment variable is not currently available to gitlab but could be implemented by sending a pull request to the webhook parsing code in the go-scm library, specifically, this function.