`heroku ci:run` needs explanatory warnings if the current git repo is in detached head state
- Dominant language
- TypeScript
- Stars
- 889
- Forks
- 236
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 33
Description
**This project is for the Heroku CLI only and issues are reviewed as we are able. If you need more immediate assistence or help with anything not specific to the CLI itself, please use https://help.heroku.com.**
Do you want to request a *feature* or report a *bug*?
-----------------------------------------------------
Feature, I guess. Though it depends on whether one considers error handling/logging to be a feature or the lack thereof to be a bug.
What is the current behavior?
-----------------------------
When running `heroku ci:run` from a detached head state, the Heroku CLI fails silently, leaving no explanation or warnings about the reasoning behind this behavior.
Suppose we're working on a git repo `my-webserver`, configured to deploy to the Heroku app `my-heroku-webserver`.
The following sequence of commands works fine:
```
cd my-webserver
git checkout dev
heroku ci:run --app my-heroku-webserver
```
The tests will build and run as configured, yay!
However, if we instead checkout to a specific commit and thus enter a detached head state:
```
cd my-webserver
git checkout 0a2dac
heroku ci:run --app my-heroku-webserver
```
Then the Heroku CLI exits silently with an exit code of 1. The error code 1 is not the issue here (see below) -- the issue is that there is no warning/error message or logging explaining the failure.
What is the expected behavior?
------------------------------
To be clear, I am NOT proposing that `heroku ci:run` should work in a detached head state -- we need to know the branch name, so it stands to reason that we must be on a branch. (For the details of what's exactly going on, we get the branch name [here](https://github.com/heroku/cli/blob/master/packages/ci/src/commands/ci/run.ts#L26) by [calling `git --symbolic-ref --short HEAD`](https://github.com/heroku/cli/blob/master/packages/ci/src/utils/git.ts#L73).)
However, it would probably be a good idea to either pass through the `stderror` from the `git` call to the user on failure or else to explain why the command is failing.
Until that's set up, I figured it might be good to get an issue up for this -- I ran into this while trying to run the Heroku CLI inside GitHub actions, which by default checks out a SHA, not a branch. Hopefully this can help others who are banging their heads against the same issue until the quick fix for this eventually works its way in.
Contributor guide
Assessment
This issue has not been assessed yet.