parameters: (token, repo, tag, archive_path, notes)
return_statement: return True
docstring: Creates a release on GitHub for the given arguments
docstring_summary: Creates a release on GitHub for the given arguments
docstring_tokens: Creates a release on GitHub for the given arguments
function: def add_release(token, repo, tag, archive_path, notes):
      '''
      Creates a release on GitHub for the given arguments
      '''
      print('token: "{}", repo: "{}", tag: "{}", archive: "{}" notes: "{}"'.format('SECURE' if token else '', repo, tag, archive_path, notes))
      
      assert token, 'No API token given'
      assert repo, 'No repo given'
      assert '/' in repo, "Repo doesn't look like a valid GitHub repo (e.g. abbeycode/UnrarKit)"
      assert tag, 'No tag given'
      assert archive_path, 'No archive path given'
      assert notes, 'No notes given'
  
      is_beta = tag_is_beta(tag)
  
      url = 'https://api.github.com/repos/{}/releases'.format(repo)
      header = {
          'Authorization': 'token {}'.format(token)
      }
      values = {
          'tag_name': tag,
          'name': 'v{}'.format(tag),
          'body': notes,
          'prerelease': True if is_beta else False
      }
      
      data = json.dumps(values)
      request = urllib2.Request(url, data, header)
      response = urllib2.urlopen(request)
      the_page = response.read()
      
      response_dict = json.loads(the_page)
      upload_url = response_dict['upload_url']
      release_url = response_dict['url']
      
      upload_carthage_archive(token, upload_url, archive_path)
  
      print('Release added: {}'.format(release_url))
      return True
function_tokens: def add_release ( token , repo , tag , archive_path , notes ) : print ( 'token: "{}", repo: "{}", tag: "{}", archive: "{}" notes: "{}"' . format ( 'SECURE' if token else '' , repo , tag , archive_path , notes ) ) assert token , 'No API token given' assert repo , 'No repo given' assert '/' in repo , "Repo doesn't look like a valid GitHub repo (e.g. abbeycode/UnrarKit)" assert tag , 'No tag given' assert archive_path , 'No archive path given' assert notes , 'No notes given' is_beta = tag_is_beta ( tag ) url = 'https://api.github.com/repos/{}/releases' . format ( repo ) header = { 'Authorization' : 'token {}' . format ( token ) } values = { 'tag_name' : tag , 'name' : 'v{}' . format ( tag ) , 'body' : notes , 'prerelease' : True if is_beta else False } data = json . dumps ( values ) request = urllib2 . Request ( url , data , header ) response = urllib2 . urlopen ( request ) the_page = response . read ( ) response_dict = json . loads ( the_page ) upload_url = response_dict [ 'upload_url' ] release_url = response_dict [ 'url' ] upload_carthage_archive ( token , upload_url , archive_path ) print ( 'Release added: {}' . format ( release_url ) ) return True