fix(git): handle properly detached HEAD ref by neilime · Pull Request #173 · docker/actions-toolkit (original) (raw)
Properly manage detached HEAD when getting ref.
- Check if we are in a detached HEAD context
- If so handle detached tag and branch context
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
Just to clarify, did you encounter an issue with the current API? I guess with metadata-action?
@crazy-max by example:
If I'm checking out a pull request branch (Needed on issue_comment event by example):
uses: actions/checkout@v3 with: ref: refs/pull/${{ github.event.issue.number }}/head
uses: docker/metadata-action@v5.0.0
I got the following error
Error: fatal: No names found, cannot describe anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})