How to get a branch name on GitHub action when push on a tag?
问题 I trigger my workflow using on: push: tags: GITHUB_REF won't contain a branch name in this case, how could I get it? 回答1: You will need to do a bit of string manipulation to get this going. Basically during a tag creation push, is like if you were to do git checkout v<tag> in your local but there's no reference to the original branch. This is why you will need to use the -r flag in the git branch contains command. We get the clean branch with the following two commands. raw=$(git branch -r -