mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-24 07:01:35 -04:00
41 lines
955 B
JavaScript
41 lines
955 B
JavaScript
class Presolver {
|
|
constructor(github, { owner, repo, logger = console, ...config }) {
|
|
this.github = github;
|
|
this.logger = logger;
|
|
this.config = Object.assign({
|
|
owner,
|
|
repo
|
|
});
|
|
this.pullRequest = {};
|
|
}
|
|
|
|
static get STATE() {
|
|
return Object.freeze({
|
|
CLASH: 'clashing'
|
|
})
|
|
|
|
async _getClashingRanges(pullRequest) {
|
|
Object.assign(this.pullRequest, pullRequest);
|
|
const { owner, repo } = this.config;
|
|
const number = this.pullRequest.number;
|
|
|
|
const prs = (await this.github.pullRequests.get({ owner, repo }))
|
|
.data || [];
|
|
this.logger(prs)
|
|
prs.forEach(function(pr){
|
|
const files = pr.files()
|
|
})
|
|
}
|
|
|
|
async presolve(pullRequest) {
|
|
Object.assign(this.pullRequest, pullRequest);
|
|
const { owner, repo } = this.config;
|
|
const number = this.pullRequest.number;
|
|
|
|
const state = await this._getClashingRanges(pullRequest);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Presolver; |