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

Fix detached #8

Merged
merged 11 commits into from
Jun 19, 2018
Merged

Fix detached #8

merged 11 commits into from
Jun 19, 2018

Conversation

jollyromp
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Jun 19, 2018

Coverage Status

Coverage increased (+0.7%) to 94.318% when pulling a9674d4 on fix-detached into 6773e2d on master.

index.js Outdated
@@ -58,7 +58,7 @@ function loadConfig () {

function getEnvIdFromBranch () {
try {
let branch = sh.exec('git status', { silent: true }).stdout
var branch = sh.exec('git status', { silent: true }).stdout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be let not var

index.js Outdated
var hash = sh.exec('git rev-parse HEAD').stdout
hash = hash.substring(0, 5)

return (branch.includes(' ')) ? hash : branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the branch includes spaces, I would prefer to replace them with dashes than to use the hash. the hash is not user friendly

@oifland
Copy link

oifland commented Jun 19, 2018 via email

@andyday
Copy link
Contributor

andyday commented Jun 19, 2018

@oifland are you doing this for it to work on gitlab ci? If so you can pass in a --env=$CI_COMMIT_REF_NAME ?? Using the hash is problematic because it would mean a new environment for each commit...

@jollyromp
Copy link
Contributor Author

Actually, wouldn't it be better if we used "git name-rev HEAD --name-only" instead of trying to parse git status?

@oifland
Copy link

oifland commented Jun 19, 2018 via email

@andyday
Copy link
Contributor

andyday commented Jun 19, 2018

@jollyromp yes -- great callout. git name-rev HEAD --name-only is much better than the current method, please make this fix.

@oifland as for spaces in names, we should either replace spaces with "" or with "-"

@jollyromp
Copy link
Contributor Author

I added the git name stuff

@jollyromp
Copy link
Contributor Author

also branches aren't allowed to have any spaces

index.js Outdated
length: 13,
omission: ''
}), '-')

return branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to have the separate variable. you can return at line 63 directly

@andyday
Copy link
Contributor

andyday commented Jun 19, 2018

👍 LGTM! One minor comment...

@andyday andyday merged commit 4bfeb91 into master Jun 19, 2018
@andyday andyday deleted the fix-detached branch June 19, 2018 20:31
@andyday
Copy link
Contributor

andyday commented Jun 19, 2018

published as 0.10.0

@jollyromp
Copy link
Contributor Author

How does this get uploaded to npm?

@andyday
Copy link
Contributor

andyday commented Jun 19, 2018

manually using npm publish. I use a tool called np to make it a bit easier.

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

Successfully merging this pull request may close these issues.

None yet

4 participants