# File lib/travis/tools/github.rb, line 223
      def create_token(gh)
        gh.post('/authorizations', :scopes => scopes, :note => note)
      rescue GH::Error => error
        # token might already exist due to bug in earlier CLI version, we'll have to delete it first
        raise error unless error.info[:response_status] == 422 and error.info[:response_body].to_s =~ /already_exists/
        raise error unless reply = gh['/authorizations'].detect { |a| a['note'] == note }
        gh.delete(reply['_links']['self']['href'])
        retry
      end