<commit_before>request = require("request")
npmPackage = require('./../package.json')
semver = require('semver')

module.exports = (callback) ->

  url = "#{npmPackage.repository.url.split("github.com").join("api.github.com/repos")}/releases/latest"

  request {url: url, headers: {"User-Agent": npmPackage.repository.url}}, (error, response, body) ->
    if error
      console.error "Could not check version at #{url}"
      callback(null)
    else if response.statusCode == 200
      json = JSON.parse(body)
      if semver.gt(json.tag_name, npmPackage.version)
        console.log "Found update: #{json.tag_name} is newer than #{npmPackage.version}"
        callback(json)
      else
        callback(null)
    else
      console.error "Version check at #{url} returned a non-200 status code."
      console.error body
      callback(null)
<commit_msg>update version check to check for upcoming repo rename<commit_after>request = require("request")
npmPackage = require('./../package.json')
semver = require('semver')

module.exports = (callback) ->

  for repoUrl in [npmPackage.repository.url, "https://github.com/looker/lookerbot"]

    url = "#{repoUrl.split("github.com").join("api.github.com/repos")}/releases/latest"

    request {url: url, headers: {"User-Agent": npmPackage.repository.url}}, (error, response, body) ->
      if error
        console.error "Could not check version at #{url}"
        callback(null)
      else if response.statusCode == 200
        json = JSON.parse(body)
        if semver.gt(json.tag_name, npmPackage.version)
          console.log "Found update: #{json.tag_name} is newer than #{npmPackage.version}"
          callback(json)
        else
          console.log "Checked for updates from #{url}. No new version available."
          callback(null)
      else
        console.error "Version check at #{url} returned a non-200 status code."
        console.error body

{'fraction_non_alphanumeric': 0.1365062761506276, 'fraction_numerical': 0.006276150627615063, 'mean_word_length': 3.122844827586207, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2981481', 'n_tokens_mistral': 571, 'n_tokens_neox': 538, 'n_words': 148}