I am running my CI on GitHub Actions, and I am using the GITHUB_REF default environment variable as a part of a download URL.
GitHub sets the GITHUB_REF
to:
refs/heads/staging
I understand from git: difference between "branchname" and "refs/heads/branchname" that the refs/heads/
prefix is needed so that git has the "full path" to the branch.
Now, I am wondering if anyone knows of an off-the-shelf node.js package deployed to a registry like npmjs that I could use to extract the branch name from the long ref string? It seems like there could be many different prefixes: refs/tags/
, refs/remotes
, etc., and I would prefer not to write my custom script if there is another solution available.