mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 17:42:57 +00:00
fix: use passed method instead of resetting it
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {Logger} from '@openstapps/logger';
|
import {Logger} from '@openstapps/logger';
|
||||||
import * as request from 'request-promise-native';
|
import request from 'request-promise-native';
|
||||||
import {
|
import {
|
||||||
AccessLevel,
|
AccessLevel,
|
||||||
Branch,
|
Branch,
|
||||||
@@ -472,7 +472,7 @@ export class Api {
|
|||||||
...options,
|
...options,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (['DELETE', 'GET', 'POST', 'PUT'].includes(_options.method)) {
|
if (!['DELETE', 'GET', 'POST', 'PUT'].includes(_options.method)) {
|
||||||
_options.method = 'GET';
|
_options.method = 'GET';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {asyncPool} from '@krlwlfrt/async-pool';
|
|||||||
import {Logger} from '@openstapps/logger';
|
import {Logger} from '@openstapps/logger';
|
||||||
import {AddLogLevel} from '@openstapps/logger/lib/transformations/add-log-level';
|
import {AddLogLevel} from '@openstapps/logger/lib/transformations/add-log-level';
|
||||||
import {Colorize} from '@openstapps/logger/lib/transformations/colorize';
|
import {Colorize} from '@openstapps/logger/lib/transformations/colorize';
|
||||||
import * as commander from 'commander';
|
import {Command} from 'commander';
|
||||||
import {readFileSync} from 'fs';
|
import {readFileSync} from 'fs';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
import {Api, ApiRequestOptions} from './api';
|
import {Api, ApiRequestOptions} from './api';
|
||||||
@@ -30,6 +30,8 @@ Logger.setTransformations([
|
|||||||
const pkgJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'))
|
const pkgJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'))
|
||||||
.toString());
|
.toString());
|
||||||
|
|
||||||
|
const commander = new Command('openstapps-gitlab-api');
|
||||||
|
|
||||||
commander
|
commander
|
||||||
.version(pkgJson.version);
|
.version(pkgJson.version);
|
||||||
|
|
||||||
@@ -77,6 +79,8 @@ commander
|
|||||||
// tslint:disable-next-line:no-magic-numbers
|
// tslint:disable-next-line:no-magic-numbers
|
||||||
await asyncPool(5, issues, async (issue) => {
|
await asyncPool(5, issues, async (issue) => {
|
||||||
if (action === 'close') {
|
if (action === 'close') {
|
||||||
|
Logger.info(`Closing issue #${issue.iid} of project '${projectId}': ${issue.title}.`);
|
||||||
|
|
||||||
await api.makeGitLabAPIRequest(`/projects/${projectId}/issues/${issue.iid}`, {
|
await api.makeGitLabAPIRequest(`/projects/${projectId}/issues/${issue.iid}`, {
|
||||||
data: {
|
data: {
|
||||||
state_event: 'close',
|
state_event: 'close',
|
||||||
|
|||||||
Reference in New Issue
Block a user