<commit_before>'use strict';

const { waterfall, mapSeries } = require('async');

module.exports = function createPreviewRelease(getRepoConfig, getReleasePreview, notify, repos) {

  return (cb) => {
    waterfall([
      (next)            => getConfigForEachRepo(repos, next),
      (reposInfo, next) => getReleasePreview(reposInfo, next),
      (reposInfo, next) => notifyPreviewInSlack(reposInfo, next)
    ], cb);
  };

  function getConfigForEachRepo(repos, cb) {
    mapSeries(repos, (repo, nextRepo) => {
      getRepoConfig(repo, (err, config) => {
        nextRepo(err, { repo, config });
      });
    }, cb);
  }

  function notifyPreviewInSlack(reposInfo, cb) {
    notify(reposInfo, 'preview', cb);
  }
};
<commit_msg>Don't break the release preview if any repo config failes<commit_after>'use strict';

const { waterfall, mapSeries } = require('async');

module.exports = function createPreviewRelease(getRepoConfig, getReleasePreview, notify, repos) {

  return (cb) => {
    waterfall([
      (next)            => getConfigForEachRepo(repos, next),
      (reposInfo, next) => getReleasePreview(reposInfo, next),
      (reposInfo, next) => notifyPreviewInSlack(reposInfo, next)
    ], cb);
  };

  function getConfigForEachRepo(repos, cb) {
    mapSeries(repos, (repo, nextRepo) => {
      getRepoConfig(repo, (err, config) => {
        if (err) {
          console.error('Error getting repo config', repo, err);
          return nextRepo(null, { repo, failReason: err.message });
        }
        nextRepo(null, { repo, config });
      });
    }, cb);
  }

  function notifyPreviewInSlack(reposInfo, cb) {
    notify(reposInfo, 'preview', cb);
  }
};

{'fraction_non_alphanumeric': 0.14499700419412823, 'fraction_numerical': 0.0, 'mean_word_length': 3.3832020997375327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5272764', 'n_tokens_mistral': 534, 'n_tokens_neox': 519, 'n_words': 114}