fix: comment section
This commit is contained in:
committed by
mrugesh mohapatra
parent
ce6129809f
commit
402f61e46d
@ -1,5 +1,6 @@
|
|||||||
const owner = 'freeCodeCamp';
|
require('dotenv').config();
|
||||||
const repo = 'freeCodeCamp';
|
const owner = process.env.REPOSITORY_OWNER;
|
||||||
|
const repo = process.env.REPOSITORY;
|
||||||
const fccBaseUrl = `https://github.com/${owner}/${repo}/`;
|
const fccBaseUrl = `https://github.com/${owner}/${repo}/`;
|
||||||
const prBaseUrl = `${fccBaseUrl}pull/`;
|
const prBaseUrl = `${fccBaseUrl}pull/`;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ const { addLabels } = require('./addLabels');
|
|||||||
const { guideFolderChecks } = require('./guideFolderChecks');
|
const { guideFolderChecks } = require('./guideFolderChecks');
|
||||||
const { addComment } = require('./addComment');
|
const { addComment } = require('./addComment');
|
||||||
|
|
||||||
octokit.authenticate(octokitAuth);
|
console.log(octokit.authenticate(octokitAuth));
|
||||||
|
|
||||||
const labelsAdder = (number, existingLabels, labelsToAdd, log) => {
|
const labelsAdder = (number, existingLabels, labelsToAdd, log) => {
|
||||||
const newLabels = Object.keys(labelsToAdd).filter(label => !existingLabels.includes(label));
|
const newLabels = Object.keys(labelsToAdd).filter(label => !existingLabels.includes(label));
|
||||||
@ -26,7 +26,7 @@ const labelsAdder = (number, existingLabels, labelsToAdd, log) => {
|
|||||||
const { PrProcessingLog } = require('./prProcessingLog');
|
const { PrProcessingLog } = require('./prProcessingLog');
|
||||||
const log = new PrProcessingLog();
|
const log = new PrProcessingLog();
|
||||||
|
|
||||||
const prPropsToGet = ['number', 'labels'];
|
const prPropsToGet = ['number', 'labels', 'user'];
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const { firstPR, lastPR } = await getPrRange();
|
const { firstPR, lastPR } = await getPrRange();
|
||||||
@ -47,7 +47,7 @@ const prPropsToGet = ['number', 'labels'];
|
|||||||
|
|
||||||
let interval = setInterval(async () => {
|
let interval = setInterval(async () => {
|
||||||
if (count < maxCount ) {
|
if (count < maxCount ) {
|
||||||
let { number, labels } = openPRs[count];
|
let { number, labels, user: {login: username} } = openPRs[count];
|
||||||
const { data: prFiles } = await octokit.pullRequests.getFiles({ owner, repo, number });
|
const { data: prFiles } = await octokit.pullRequests.getFiles({ owner, repo, number });
|
||||||
log.add(number)
|
log.add(number)
|
||||||
const existingLabels = labels.map(({ name }) => name);
|
const existingLabels = labels.map(({ name }) => name);
|
||||||
@ -61,17 +61,12 @@ const prPropsToGet = ['number', 'labels'];
|
|||||||
if (second && validLabels[second]) { labelsToAdd[validLabels[second]] = 1 }
|
if (second && validLabels[second]) { labelsToAdd[validLabels[second]] = 1 }
|
||||||
})
|
})
|
||||||
|
|
||||||
/* if guide folder/file name has issues add applicable label and comment to PR
|
const guideFolderErrorsComment = guideFolderChecks(filename, username);
|
||||||
|
|
||||||
NOTE: Currently need to resolve a bug with addComment.js before adding this feature
|
|
||||||
|
|
||||||
const guideFolderErrorsComment = guideFolderChecks(filename, user, hasPrevComments);
|
|
||||||
if (guideFolderErrors) {
|
if (guideFolderErrors) {
|
||||||
// add hasPrevComments
|
|
||||||
addComment(number, guideFolderErrorsComment);
|
addComment(number, guideFolderErrorsComment);
|
||||||
labelsToAdd['status: needs update'] = 1;
|
labelsToAdd['status: needs update'] = 1;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
labelsAdder(number, existingLabels, labelsToAdd, log);
|
labelsAdder(number, existingLabels, labelsToAdd, log);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user