{"action":"created","issue":{"url":"https://api.github.com/repos/sturdynut/git-prepush-hook/issues/1","labels_url":"https://api.github.com/repos/sturdynut/git-prepush-hook/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/sturdynut/git-prepush-hook/issues/1/comments","events_url":"https://api.github.com/repos/sturdynut/git-prepush-hook/issues/1/events","html_url":"https://github.com/sturdynut/git-prepush-hook/issues/1","id":114538966,"number":1,"title":"`process.env.npm_lifecycle_event` doesn't get set when running through a hook","user":{"login":"bebraw","id":166921,"avatar_url":"https://avatars.githubusercontent.com/u/166921?v=3","gravatar_id":"","url":"https://api.github.com/users/bebraw","html_url":"https://github.com/bebraw","followers_url":"https://api.github.com/users/bebraw/followers","following_url":"https://api.github.com/users/bebraw/following{/other_user}","gists_url":"https://api.github.com/users/bebraw/gists{/gist_id}","starred_url":"https://api.github.com/users/bebraw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bebraw/subscriptions","organizations_url":"https://api.github.com/users/bebraw/orgs","repos_url":"https://api.github.com/users/bebraw/repos","events_url":"https://api.github.com/users/bebraw/events{/privacy}","received_events_url":"https://api.github.com/users/bebraw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-02T07:08:14Z","updated_at":"2015-11-06T07:04:03Z","closed_at":null,"body":"I'm not sure if this is by design but for some reason `npm_lifecycle_event` doesn't get set. My [boilerplate](https://survivejs.github.io/react-component-boilerplate/) happens to depend on that. I managed to work around the problem. If it's correct behavior, it would be good to document at least."},"comment":{"url":"https://api.github.com/repos/sturdynut/git-prepush-hook/issues/comments/154330768","html_url":"https://github.com/sturdynut/git-prepush-hook/issues/1#issuecomment-154330768","issue_url":"https://api.github.com/repos/sturdynut/git-prepush-hook/issues/1","id":154330768,"user":{"login":"bebraw","id":166921,"avatar_url":"https://avatars.githubusercontent.com/u/166921?v=3","gravatar_id":"","url":"https://api.github.com/users/bebraw","html_url":"https://github.com/bebraw","followers_url":"https://api.github.com/users/bebraw/followers","following_url":"https://api.github.com/users/bebraw/following{/other_user}","gists_url":"https://api.github.com/users/bebraw/gists{/gist_id}","starred_url":"https://api.github.com/users/bebraw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bebraw/subscriptions","organizations_url":"https://api.github.com/users/bebraw/orgs","repos_url":"https://api.github.com/users/bebraw/repos","events_url":"https://api.github.com/users/bebraw/events{/privacy}","received_events_url":"https://api.github.com/users/bebraw/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T07:04:03Z","updated_at":"2015-11-06T07:04:03Z","body":"I do a check like `if (TARGET === 'test' || TARGET === 'tdd' || !TARGET) {`. That last one matches for the hook given `TARGET` is `undefined` in that case. `TARGET` is set like this: `const TARGET = process.env.npm_lifecycle_event;`.\r\n\r\nIt's likely easy to set up a little test case. You'll need something like this:\r\n\r\n```javascript\r\nconst TARGET = process.env.npm_lifecycle_event;\r\n\r\n// you could assert now that TARGET matches hook name\r\nconsole.log(TARGET);\r\n```"}}