fix: use passed method instead of resetting it

This commit is contained in:
Karl-Philipp Wulfert
2020-01-08 16:32:24 +01:00
parent 07b8d2aabf
commit db5645732c
2 changed files with 7 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ import {asyncPool} from '@krlwlfrt/async-pool';
import {Logger} from '@openstapps/logger';
import {AddLogLevel} from '@openstapps/logger/lib/transformations/add-log-level';
import {Colorize} from '@openstapps/logger/lib/transformations/colorize';
import * as commander from 'commander';
import {Command} from 'commander';
import {readFileSync} from 'fs';
import {join} from 'path';
import {Api, ApiRequestOptions} from './api';
@@ -30,6 +30,8 @@ Logger.setTransformations([
const pkgJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'))
.toString());
const commander = new Command('openstapps-gitlab-api');
commander
.version(pkgJson.version);
@@ -77,6 +79,8 @@ commander
// tslint:disable-next-line:no-magic-numbers
await asyncPool(5, issues, async (issue) => {
if (action === 'close') {
Logger.info(`Closing issue #${issue.iid} of project '${projectId}': ${issue.title}.`);
await api.makeGitLabAPIRequest(`/projects/${projectId}/issues/${issue.iid}`, {
data: {
state_event: 'close',