gajus/gitdown

Error: Cannot get the current branch name

Closed this issue · 1 comments

My local builds work fine, but my travis-ci builds give me this error:

jsdoc-examples@1.0.0 gitdown /home/travis/build/billmoser/examples-plugin-jsdoc
gitdown ./.README/README.md --output-file ./README.md
(node:5304) UnhandledPromiseRejectionWarning: Error: Cannot get the current branch name.
at Object.gitinfo.getBranchName (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitinfo/dist/gitinfo.js:85:11)
at Object.gitinfo.getRemoteUrl (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitinfo/dist/gitinfo.js:94:32)
at Object.gitinfo.getUsername (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitinfo/dist/gitinfo.js:132:53)
at Object.gitinfo.getGithubUrl (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitinfo/dist/gitinfo.js:51:44)
at Object.helper.compile (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitdown/dist/helpers/gitinfo.js:36:41)
at Object.gitdown.resolveURLs (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitdown/dist/gitdown.js:111:35)
at Object.gitdown.get (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitdown/dist/gitdown.js:54:19)
at async Object.gitdown.writeFile (/home/travis/build/billmoser/examples-plugin-jsdoc/node_modules/gitdown/dist/gitdown.js:66:26)
(Use node --trace-warnings ... to show where the warning was created)
(node:5304) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5304) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

there seems to be a parameter called config.defaultBranchName that might be applicable here, but I have no idea how to use it in my README.md

gajus commented

You would typically get this error in a detached HEAD state, or in case you are not in a git directory.

You will need to debug this further to evaluate if either of the above is true. Start by adding git branch to your CI/CD pipeline and see what it prints just before this error.