     cp path.join(docsOutputDir, 'api.json'), path.join(buildDir, 'atom-api.json')
 
   grunt.registerTask 'upload-assets', 'Upload the assets to a GitHub release', ->
-    switch process.env.JANKY_BRANCH
+    branchName = process.env.JANKY_BRANCH
+    switch branchName
       when 'stable'
         isPrerelease = false
       when 'beta'

    tasks.push(zip.bind(this, buildDir, sourcePath, assetName))
  async.parallel(tasks, callback)

getAtomDraftRelease = (isPrerelease, callback) ->
  atomRepo = new GitHub({repo: 'atom/atom', token})
  atomRepo.getReleases {prerelease: isPrerelease}, (error, releases=[]) ->
    if error?

            firstDraft.assets = assets
            callback(null, firstDraft)
      else
        createAtomDraftRelease(isPrerelease, branchName, callback)

createAtomDraftRelease = (isPrerelease, branchName, callback) ->
  {version} = require('../../package.json')
  options =
    uri: 'https://api.github.com/repos/atom/atom/releases'
