An extremely common use case for build pipelines is to get the current branch name. This is useful because the name can be used as part of infrastructure deployments and naming, for example.
There are several Stack Overflow questions and dozens of existing “get branch name” actions on the marketplace. All of the answers and existing solutions have brittle code in them and many of the accepted answers only work for PR’s and not pushes, for example.
Worse still, many of them show the deprecated
As you can see, this leads to a confusing user experience and an unsatisfactory solution of “use a third party solution to get the branch name even though GitHub’s UI has no problem figuring out the branch name”.
Instead of getting a environment variable containing
refs/heads/my-feature=branch another environment variable containing
For reference with BitBucket pipelines this is already implemented as simply
I’m not sure why this can’t be built in and exposed in the environment variables and context without needing to write inline Bash scripts just to extract, parse, format and then set a new environment variable.
Please can this be implemented?