<commit_before>var fs = require('fs');
var Github = require('github-api');

require('dotenv').config();

var github = new Github({
  username: process.env.GIT_USER,
  password: <PASSWORD>,
  auth: 'basic'
});
var repository = github.getRepo('surveyjs', 'service');

function commit(inputPath, outputPath, comment) {
   var content = fs.readFileSync(inputPath, 'utf8');
   repository.writeFile(
      'master',
      outputPath,
      content,
      comment,
      function(err) {
         let log = 'inputPath=' + inputPath +
            ', outputPath=' + outputPath + ', comment=' + comment;
         if (!err) {
            console.log('Success: ' + log);
         }
         else{ 
            console.log('Failure: ' + log);
         }
      }
   );
}

commit('doc_generator/classes.json', 'surveyjs.io/App_Data/Docs/classes.json', 'Updated Classes API documentation');
commit('doc_generator/pmes.json', 'surveyjs.io/App_Data/Docs/pmes.json', 'Updated Properties API documentation');
commit('docs/sidebar.json', 'surveyjs.io/App_Data/Docs/sidebar.json', 'Updated SideBar');
commit('docs/CreateQuiz.md', 'surveyjs.io/App_Data/Docs/CreateQuiz.md', 'Updated CreadQuiz.md');
commit('docs/LibraryOverview.md', 'surveyjs.io/App_Data/Docs/LibraryOverview.md', 'Updated LibraryOverview.md');
commit('docs/Question/visibleIf.md', 'surveyjs.io/App_Data/Docs/Question/visibleIf.md', 'Updated visibleIf.md');
commit('docs/images/builder-adorners.png', 'surveyjs.io/Content/Images/docs/builder-adorners.png', 'Updated builder-adorners.png');
commit('docs/images/builder-question-editor.png', 'surveyjs.io/Content/Images/docs/builder-question-editor.png', 'Updated builder-question-editor.png');
commit('docs/images/choicesbyurl.png', 'surveyjs.io/Content/Images/docs/choicesbyurl.png', 'Updated choicesbyurl.png');<commit_msg>Fix async documentation commit to github.<commit_after>var fs = require('fs');
var Github = require('github-api');

require('dotenv').config();

var github = new Github({
  username: process.env.GIT_USER,
  password: <PASSWORD>,
  auth: 'basic'
});
var repository = github.getRepo('surveyjs', 'service');


function commit(inputPath, outputPath, comment) {
   return new Promise(function(resolve, reject) {
      var content = fs.readFileSync(inputPath, 'utf8');
      repository.writeFile(
         'master',
         outputPath,
         content,
         comment,
         function(err) {
            let log = 'inputPath=' + inputPath +
            ', outputPath=' + outputPath + ', comment=' + comment;
            if (!err) {
               console.log('Success: ' + log);
            }
            else{ 
               console.log('Failure: ' + log + "\n" + err);
            }
            resolve();
         }
      );
   });
}

commit('doc_generator/classes.json', 'surveyjs.io/App_Data/Docs/classes.json', 'Updated Classes API documentation').then(
 () => commit('doc_generator/pmes.json', 'surveyjs.io/App_Data/Docs/pmes.json', 'Updated Properties API documentation')).then(
 () => commit('docs/sidebar.json', 'surveyjs.io/App_Data/Docs/sidebar.json', 'Updated SideBar')).then(
 () => commit('docs/CreateQuiz.md', 'surveyjs.io/App_Data/Docs/CreateQuiz.md', 'Updated CreadQuiz.md')).then(
 () => commit('docs/LibraryOverview.md', 'surveyjs.io/App_Data/Docs/LibraryOverview.md', 'Updated LibraryOverview.md')).then(
 () => commit('docs/Question/visibleIf.md', 'surveyjs.io/App_Data/Docs/Question/visibleIf.md', 'Updated visibleIf.md')).then(
 () => commit('docs/images/builder-adorners.png', 'surveyjs.io/Content/Images/docs/builder-adorners.png', 'Updated builder-adorners.png')).then(
 () => commit('docs/images/builder-question-editor.png', 'surveyjs.io/Content/Images/docs/builder-question-editor.png', 'Updated builder-question-editor.png')).then(
 () => commit('docs/images/choicesbyurl.png', 'surveyjs.io/Content/Images/docs/choicesbyurl.png', 'Updated choicesbyurl.png'));
{'fraction_non_alphanumeric': 0.17272262026612079, 'fraction_numerical': 0.0005117707267144319, 'mean_word_length': 3.814039408866995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '3721862', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1246, 'n_words': 191}