Method for retrieving all reviews for a given timeframe

This commit is contained in:
galfert 2021-01-07 22:15:12 +01:00
parent 02b737aca3
commit 7626c6c1b2

View File

@ -14,15 +14,15 @@ const endDate = new Date('2020-12-30T23:59:59Z');
const repos = require('./repos.json');
const giteaReviews = new GiteaReviews(process.env.GITEA_TOKEN, kreditsAmounts);
async function getAllReviews(repos, startDate, endDate) {
const githubReviews = new GithubReviews(process.env.GITHUB_TOKEN, kreditsAmounts);
const giteaReviews = new GiteaReviews(process.env.GITEA_TOKEN, kreditsAmounts);
giteaReviews.getReviewContributions(repos.gitea, startDate, endDate).then(reviewContributions => {
console.log('GITEA REVIEW CONTRIBUTIONS', reviewContributions);
});
const githubReviews = new GithubReviews(process.env.GITHUB_TOKEN, kreditsAmounts);
githubReviews.getReviewContributions(repos.github, startDate, endDate).then(reviewContributions => {
console.log('GITHUB REVIEW CONTRIBUTIONS', reviewContributions);
});
return Promise.all([
githubReviews.getReviewContributions(repos.github, startDate, endDate),
giteaReviews.getReviewContributions(repos.gitea, startDate, endDate)
]).then(reviews => {
return { github: reviews[0], gitea: reviews[1] }
});
}