GithubHelp home page GithubHelp logo

Comments (10)

based64god avatar based64god commented on May 22, 2024 3

For anyone who finds this in the future, you want DRONE_SOURCE_BRANCH.

from go-scm.

bradrydzewski avatar bradrydzewski commented on May 22, 2024 1

nope, DRONE_COMMIT_BRANCH has always been the target branch, including in 0.8. In 1.0 we also provide more explicit values DRONE_SOURCE_BRANCH and DRONE_TARGET_BRANCH

from go-scm.

bradrydzewski avatar bradrydzewski commented on May 22, 2024

Hmmm, I am unable to reproduce this issue (drone 1.0.0-rc.5). The mapping of source and target branch for merge request for GitLab can be found here:
https://github.com/drone/go-scm/blob/master/scm/driver/gitlab/webhook.go#L244:L245

from go-scm.

based64god avatar based64god commented on May 22, 2024

image
Here's a screenshot of the build log. I don't see this for builds triggered by pushes. It's only for ones triggered by merge events. Are there any logs I can push up here that might be useful?

from go-scm.

based64god avatar based64god commented on May 22, 2024

Small update.
image
Appears to be working as intended.

from go-scm.

quantonganh avatar quantonganh commented on May 22, 2024

@bradrydzewski So, we agree that DRONE_COMMIT_BRANCH should refer to source branch (as in 0.8), right?

https://github.com/drone/drone/blob/2a3ffc779ba33a9d9c14ec4faae4cbaac0d898ad/operator/runner/env.go#L85

from go-scm.

quantonganh avatar quantonganh commented on May 22, 2024

DRONE_COMMIT_BRANCH has always been the target branch, including in 0.8

I don't think so: https://github.com/drone/drone/blob/768ed784bd74b0e0c2d8d49c4c8b6dca99b25e96/remote/gitlab/gitlab.go#L530

from go-scm.

bradrydzewski avatar bradrydzewski commented on May 22, 2024

for GitHub and other providers it was target branch. If GitLab were using source branch previously it was a bug. The 1.0 implementation is the desired state.

from go-scm.

quantonganh avatar quantonganh commented on May 22, 2024

for GitHub and other providers it was target branch.

OK: https://github.com/drone/drone/blob/768ed784bd74b0e0c2d8d49c4c8b6dca99b25e96/remote/github/convert.go#L268

But IMO, it should be source branch, as target branch often is master.

The question is: Is there any env that we can use to refer to the source branch (for both push and pull_request events)?

from go-scm.

bradrydzewski avatar bradrydzewski commented on May 22, 2024

yes, you can use DRONE_SOURCE_BRANCH for push and pull_request events.

from go-scm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.