How To Get The Feature/Branch Name In Command/Script In Drone?

Module

  • Drone

Environment

  • Infrastructure: Drone CLI
  • OS: Linux

Issue

How to get the feature/branch_name in command/script in drone?

trigger:
  branch:
  - feature/*

Resolution

Use the following environment variable in your pipeline.

DRONE_BRANCH=master

This provides the target branch to perform the push/pull request.