Skip to content

Commit

Permalink
chore: update index
Browse files Browse the repository at this point in the history
  • Loading branch information
C0ZEN committed Jun 3, 2021
1 parent 9876204 commit 2f93a2a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions dist/index.js
Expand Up @@ -255,7 +255,7 @@ class IssuesProcessor {
this.removedLabelIssues = [];
this.options = options;
this.client = github_1.getOctokit(this.options.repoToken);
this._operations = new stale_operations_1.StaleOperations(this.options);
this.operations = new stale_operations_1.StaleOperations(this.options);
this._logger.info(logger_service_1.LoggerService.yellow(`Starting the stale action process...`));
if (this.options.debugOnly) {
this._logger.warning(logger_service_1.LoggerService.yellowBright(`Executing in debug mode!`));
Expand Down Expand Up @@ -283,22 +283,22 @@ class IssuesProcessor {
: option_1.Option.StaleIssueMessage;
}
processIssues(page = 1) {
var _a, _b;
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
// get the next batch of issues
const issues = yield this.getIssues(page);
const actor = yield this.getActor();
if (issues.length <= 0) {
this._logger.info(logger_service_1.LoggerService.green(`No more issues found to process. Exiting...`));
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.setRemainingOperations(this._operations.getRemainingOperationsCount()).logStats();
return this._operations.getRemainingOperationsCount();
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
return this.operations.getRemainingOperationsCount();
}
else {
this._logger.info(`${logger_service_1.LoggerService.yellow('Processing the batch of issues')} ${logger_service_1.LoggerService.cyan(`#${page}`)} ${logger_service_1.LoggerService.yellow('containing')} ${logger_service_1.LoggerService.cyan(issues.length)} ${logger_service_1.LoggerService.yellow(`issue${issues.length > 1 ? 's' : ''}...`)}`);
}
for (const issue of issues.values()) {
// Stop the processing if no more operations remains
if (!this._operations.hasRemainingOperations()) {
if (!this.operations.hasRemainingOperations()) {
break;
}
const issueLogger = new issue_logger_1.IssueLogger(issue);
Expand Down Expand Up @@ -451,9 +451,10 @@ class IssuesProcessor {
}
IssuesProcessor._endIssueProcessing(issue);
}
if (!this._operations.hasRemainingOperations()) {
if (!this.operations.hasRemainingOperations()) {
this._logger.warning(logger_service_1.LoggerService.yellowBright(`No more operations left! Exiting...`));
this._logger.warning(`${logger_service_1.LoggerService.yellowBright('If you think that not enough issues were processed you could try to increase the quantity related to the')} ${this._logger.createOptionLink(option_1.Option.OperationsPerRun)} ${logger_service_1.LoggerService.yellowBright('option which is currently set to')} ${logger_service_1.LoggerService.cyan(this.options.operationsPerRun)}`);
(_c = this._statistics) === null || _c === void 0 ? void 0 : _c.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
return 0;
}
this._logger.info(`${logger_service_1.LoggerService.green('Batch')} ${logger_service_1.LoggerService.cyan(`#${page}`)} ${logger_service_1.LoggerService.green('processed.')}`);
Expand All @@ -467,7 +468,7 @@ class IssuesProcessor {
return __awaiter(this, void 0, void 0, function* () {
// Find any comments since date on the given issue
try {
this._operations.consumeOperation();
this.operations.consumeOperation();
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCommentsCount();
const comments = yield this.client.issues.listComments({
owner: github_1.context.repo.owner,
Expand All @@ -488,7 +489,7 @@ class IssuesProcessor {
return __awaiter(this, void 0, void 0, function* () {
let actor;
try {
this._operations.consumeOperation();
this.operations.consumeOperation();
actor = yield this.client.users.getAuthenticated();
}
catch (error) {
Expand All @@ -504,7 +505,7 @@ class IssuesProcessor {
// generate type for response
const endpoint = this.client.issues.listForRepo;
try {
this._operations.consumeOperation();
this.operations.consumeOperation();
const issueResult = yield this.client.issues.listForRepo({
owner: github_1.context.repo.owner,
repo: github_1.context.repo.repo,
Expand Down Expand Up @@ -863,7 +864,7 @@ class IssuesProcessor {
});
}
_consumeIssueOperation(issue) {
this._operations.consumeOperation();
this.operations.consumeOperation();
issue.operations.consumeOperation();
}
_getDaysBeforeStaleUsedOptionName(issue) {
Expand Down Expand Up @@ -1263,8 +1264,8 @@ class Statistics {
}
return this._incrementUndoStaleIssuesCount(increment);
}
setRemainingOperations(remainingOperations) {
this._operationsCount = remainingOperations;
setOperationsCount(operationsCount) {
this._operationsCount = operationsCount;
return this;
}
incrementClosedItemsCount(issue, increment = 1) {
Expand Down

0 comments on commit 2f93a2a

Please sign in to comment.