def add_first_occurring_tag_to_prs(tags, prs)
      total = prs.count

      prs_left = associate_tagged_prs(tags, prs, total)
      prs_left = associate_release_branch_prs(prs_left, total)
      prs_left = associate_rebase_comment_prs(tags, prs_left, total) if prs_left.any?
      # PRs in prs_left will be untagged, not in release branch, and not
      # rebased. They should not be included in the changelog as they probably
      # have been merged to a branch other than the release branch.
      @pull_requests -= prs_left
      Helper.log.info "Associating PRs with tags: #{total}/#{total}"
    end
def add_first_occurring_tag_to_prs(tags, prs)
      total = prs.count

      prs_left = associate_tagged_prs(tags, prs, total)
      prs_left = associate_release_branch_prs(prs_left, total)
      prs_left = associate_rebase_comment_prs(tags, prs_left, total) if prs_left.any?
      # PRs in prs_left will be untagged, not in release branch, and not
      # rebased. They should not be included in the changelog as they probably
      # have been merged to a branch other than the release branch.
      @pull_requests -= prs_left
      Helper.log.info "Associating PRs with tags: #{total}/#{total}"
    end
Adds a key "first_occurring_tag" to each PR with a value of the oldest
 tag that a PR's merge commit occurs in in the git history. This should
 indicate the release of each PR by git's history regardless of dates and
 divergent branches.

 @param [Array] tags The tags sorted by time, newest to oldest.
 @param [Array] prs The PRs to discover the tags of.
 @return [Nil] No return; PRs are updated in-place.