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

Status command cannot cope with detached head #116

Open
bittrance opened this issue Oct 25, 2021 · 0 comments
Open

Status command cannot cope with detached head #116

bittrance opened this issue Oct 25, 2021 · 0 comments

Comments

@bittrance
Copy link
Contributor

The status command today depends on libgit2 get_repository_head in order to find the current branch name. However, it does not support detached head (there is a get_repository_head_detached for that but a detached head does not point to a branch so this does not help) and errors with "reference 'HEAD' is neither a local nor a remote branch." Unfortunately, the GitHub checkout action intentionally creates a detached head when checking out for a pull request, meaning that we cannot find the branch name by simply looking at HEAD.

There is a work-around described here actions/checkout#124 (comment) which probably works (doing git checkout ${{ github.head_ref }} between checkout action and gitops-promotion status action seems to resolve the issue. However, I'm thinking the correct fix for this is to require the caller to provide the branch name when calling status. Opinions?

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

No branches or pull requests

1 participant