Adding changes for PR review comments III

Signed-off-by: Balasundaram <balabtech@hotmail.com>
This commit is contained in:
Balasundaram
2021-12-08 16:34:09 -05:00
parent a955e16875
commit 8ee5b6f3dd
2 changed files with 12 additions and 9 deletions
+2 -2
View File
@@ -40,8 +40,8 @@
"@backstage/plugin-scaffolder-common": "^0.1.1",
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.1.3",
"@backstage/types": "^0.1.1",
"@gitbeaker/core": "^30.2.0",
"@gitbeaker/node": "^30.2.0",
"@gitbeaker/core": "^35.1.0",
"@gitbeaker/node": "^35.1.0",
"@octokit/rest": "^18.5.3",
"@octokit/webhooks": "^9.14.1",
"@types/express": "^4.17.6",
@@ -17,7 +17,8 @@ import { createTemplateAction } from '../../createTemplateAction';
import { readFile } from 'fs-extra';
import { Gitlab } from '@gitbeaker/node';
import globby from 'globby';
import { CommitAction } from '@gitbeaker/core/dist/types/services/Commits';
import { Types } from '@gitbeaker/core';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { InputError } from '@backstage/errors';
import { parseRepoUrl } from './util';
@@ -96,7 +97,11 @@ export const createPublishGitlabMergeRequestAction = (options: {
const { host } = parseRepoUrl(repoUrl, integrations);
const integrationConfig = integrations.gitlab.byHost(host);
const actions: CommitAction[] = [];
/* const a : Types.CommitAction = {
action: 'create',
filePath: ''
};*/
const actions: Types.CommitAction[] = [];
const destinationBranch = ctx.input.branchName;
@@ -147,9 +152,7 @@ export const createPublishGitlabMergeRequestAction = (options: {
ctx.input.projectid,
destinationBranch,
String(defaultBranch),
).then(branchResponse => {
return branchResponse;
});
);
} catch (e) {
throw new InputError(`The branch creation failed ${e}`);
}
@@ -168,13 +171,13 @@ export const createPublishGitlabMergeRequestAction = (options: {
}
try {
const mergeRequestUrl: any = await api.MergeRequests.create(
const mergeRequestUrl = await api.MergeRequests.create(
ctx.input.projectid,
destinationBranch,
String(defaultBranch),
ctx.input.title,
{ description: ctx.input.description },
).then(mergeRequest => {
).then((mergeRequest: { web_url: string }) => {
return mergeRequest.web_url;
});
ctx.output('projectid', ctx.input.projectid);