<commit_before>class SyncExtensionRepoWorker
  include Sidekiq::Worker

  def perform(extension_id, compatible_platforms = [])
    @extension = Extension.find(extension_id)
    `git clone #{@extension.github_url} #{@extension.repo_path}`

    `cd #{@extension.repo_path} && git pull`
    tags = `cd #{@extension.repo_path} && git tag`.split("\n")

    SyncExtensionContentsAtVersionsWorker.perform_async(extension_id, ["master", *tags], compatible_platforms)
  end
end<commit_msg>Delete versions where release doesn't exist<commit_after>class SyncExtensionRepoWorker
  include Sidekiq::Worker

  def perform(extension_id, compatible_platforms = [])
    @extension = Extension.find(extension_id)
    `git clone #{@extension.github_url} #{@extension.repo_path}`

    `cd #{@extension.repo_path} && git pull`
    tags = @extension.octokit.releases(@extension.github_repo).map { |r| r[:tag_name] }
    @extension.extension_versions.where.not(version: tags).destroy_all

    SyncExtensionContentsAtVersionsWorker.perform_async(extension_id, ["master", *tags], compatible_platforms)
  end
end
{'fraction_non_alphanumeric': 0.1261510128913444, 'fraction_numerical': 0.0, 'mean_word_length': 5.923566878980892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3941356', 'n_tokens_mistral': 335, 'n_tokens_neox': 327, 'n_words': 61}