message: Adding prettier changes
diff: @@ -74,7 +74,7 @@ export const createPublishGitlabMergeRequestAction = (options: {
  type: 'string',
  title: 'Repository Subdirectory',
  description: 'Subdirectory of repository to apply changes to',
  - }
  + },
  },
  },
  output: {
  @@ -97,14 +97,16 @@ export const createPublishGitlabMergeRequestAction = (options: {
  const { host } = parseRepoUrl(repoUrl, integrations);
  const integrationConfig = integrations.gitlab.byHost(host);
  - let actions: CommitAction[] = [];
  + const actions: CommitAction[] = [];
  const formatedTimestamp = () => {
  - const d = new Date()
  + const d = new Date();
  const date = d.toISOString().split('T')[0];
  - const time = d.toTimeString().split(' ')[0].replace(/:/g, "_");
  - return `${date}_${time}`
  - }
  - const destinationBranch = ctx.input.destinationBranch? ctx.input.destinationBranch + formatedTimestamp(): `backstage_${formatedTimestamp()}`;
  + const time = d.toTimeString().split(' ')[0].replace(/:/g, '_');
  + return `${date}_${time}`;
  + };
  + const destinationBranch = ctx.input.destinationBranch
  + ? ctx.input.destinationBranch + formatedTimestamp()
  + : `backstage_${formatedTimestamp()}`;
  if (!integrationConfig) {
  throw new InputError(
  @@ -137,37 +139,58 @@ export const createPublishGitlabMergeRequestAction = (options: {
  });
  for (let i = 0; i < repoFilePaths.length; i++) {
  - actions.push({ action:'create', filePath:repoFilePaths[i], content: fileContents[i].toString()});
  + actions.push({
  + action: 'create',
  + filePath: repoFilePaths[i],
  + content: fileContents[i].toString(),
  + });
  }
  -
  - const defaultBranch: any = await api.Projects.show(ctx.input.projectid).then((projectJSON) => {
  + const defaultBranch: any = await api.Projects.show(
  + ctx.input.projectid,
  + ).then(projectJSON => {
  return projectJSON?.default_branch;
  });
  try {
  - await api.Branches.create(ctx.input.projectid, destinationBranch, defaultBranch).then((branchResponse) => {
  + await api.Branches.create(
  + ctx.input.projectid,
  + destinationBranch,
  + defaultBranch,
  + ).then(branchResponse => {
  return branchResponse;
  });
  } catch (e) {
  - throw new InputError(`The branch creation failed ` + e);
  + throw new InputError(`The branch creation failed ${e}`);
  }
  try {
  - await api.Commits.create(ctx.input.projectid, destinationBranch, ctx.input.title, actions);
  + await api.Commits.create(
  + ctx.input.projectid,
  + destinationBranch,
  + ctx.input.title,
  + actions,
  + );
  } catch (e) {
  - throw new InputError(`Committing the changes to ` + destinationBranch + ` failed ` + e);
  + throw new InputError(
  + `Committing the changes to ${destinationBranch} failed ${e}`,
  + );
  }
  try {
  - let mergeRequestUrl: any = await api.MergeRequests.create(ctx.input.projectid, destinationBranch, defaultBranch, ctx.input.title, { description: ctx.input.description }).then((mergeRequest) => {
  - return mergeRequest.web_url
  + const mergeRequestUrl: any = await api.MergeRequests.create(
  + ctx.input.projectid,
  + destinationBranch,
  + defaultBranch,
  + ctx.input.title,
  + { description: ctx.input.description },
  + ).then(mergeRequest => {
  + return mergeRequest.web_url;
  });
  ctx.output('projectid', ctx.input.projectid);
  ctx.output('mergeRequestUrl', mergeRequestUrl);
  - }
  - catch(e) {
  - throw new InputError(`Merge request creation failed` + e);
  + } catch (e) {
  + throw new InputError(`Merge request creation failed${e}`);
  }
  },
  });
  