29 lines
899 B
JavaScript
29 lines
899 B
JavaScript
require('dotenv').config()
|
|
const GiteaReviews = require('./lib/gitea-reviews');
|
|
const GithubReviews = require('./lib/github-reviews');
|
|
|
|
const kreditsAmounts = {
|
|
'kredits-1': 100,
|
|
'kredits-2': 300,
|
|
'kredits-3': 1000
|
|
};
|
|
|
|
// TODO get the dates from params or user input
|
|
const startDate = new Date('2020-11-01T00:00:00Z');
|
|
const endDate = new Date('2020-12-30T23:59:59Z');
|
|
|
|
const repos = require('./repos.json');
|
|
|
|
async function getAllReviews(repos, startDate, endDate) {
|
|
const githubReviews = new GithubReviews(process.env.GITHUB_TOKEN, kreditsAmounts);
|
|
const giteaReviews = new GiteaReviews(process.env.GITEA_TOKEN, kreditsAmounts);
|
|
|
|
return Promise.all([
|
|
githubReviews.getReviewContributions(repos.github, startDate, endDate),
|
|
giteaReviews.getReviewContributions(repos.gitea, startDate, endDate)
|
|
]).then(reviews => {
|
|
return { github: reviews[0], gitea: reviews[1] }
|
|
});
|
|
}
|
|
|