Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] determine branch-name when tag is pushed/triggers workflow #158

Closed
2 tasks done
arauchberger opened this issue Aug 11, 2022 · 3 comments · Fixed by #168
Closed
2 tasks done

[Feature] determine branch-name when tag is pushed/triggers workflow #158

arauchberger opened this issue Aug 11, 2022 · 3 comments · Fixed by #168
Labels
enhancement New feature or request

Comments

@arauchberger
Copy link

arauchberger commented Aug 11, 2022

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

when the workflow is triggered by a created/pushed tag it's hard to find the branch-name the tag is created on.

Describe the solution you'd like?

i suggest the following approach via git log ... (works at least for me):

if [[ $GITHUB_REF == *"/tags/"* ]]; then
  IS_TAG=true
  TAG_NAME=$(basename $GITHUB_REF)
  BRANCH_NAME=$(git log -1 --format='%D' $GITHUB_SHA | sed -e 's/.*origin\/\(.*\)/\1/')
else
  IS_TAG=false
  TAG_NAME=''
  BRANCH_NAME=${{ github.head_ref || github.ref_name }} # whether it's a pull_reguest or not

Describe alternatives you've considered?

No response

Anything else?

i'm not good in opening/handling PR's on foreign GitHub-projects, that's why i just write this suggestion to still contribute 'a little bit'.

i like your gh-action!
thanks

Code of Conduct

  • I agree to follow this project's Code of Conduct
@arauchberger arauchberger added the enhancement New feature or request label Aug 11, 2022
@github-actions
Copy link

Thanks for reporting this issue, don't forget to star this project to help us reach a wider audience.

@arauchberger
Copy link
Author

hi @jackton1,
i see you fixed this. so the the current_branch is also detected if the wf is triggered by a tag.
one more question:
i experienced that my workaround works only if the tag is set on the latest/head-commit. if you tag an older commit the branch still can not be detected.
will this be an issue for you too?

@jackton1
Copy link
Member

jackton1 commented Sep 14, 2022

@arauchberger It would be helpful if you can include an example application which explains the issue you are seeing.. No, I don’t think it should be an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants