This repository has been archived on 2025-01-23. You can view files and clone it, but cannot push or open issues or pull requests.
kredits-reviews/index.js

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] }
});
}