@clickview/ship-it 0.0.43-rc.2 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,4 @@
1
+ include:
2
+ - project: 'Clickview/Templates'
3
+ file: 'shared-ci-templates/run-danger.yml'
4
+ ref: master
package/Dangerfile ADDED
@@ -0,0 +1,5 @@
1
+ require "gitlab-dangerfiles"
2
+
3
+ Dir.glob('danger/*').each do |file|
4
+ danger.import_dangerfile(path: file)
5
+ end
package/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
+
6
+ gem 'gitlab-dangerfiles', require: false
7
+ gem 'danger'
@@ -0,0 +1,42 @@
1
+ source_branch = ENV['CI_COMMIT_REF_NAME'] || ''
2
+
3
+ # Skip if not a hotfix or release branch
4
+ unless source_branch.match?(/^hotfix\/|^release\//)
5
+ message("ℹ️ Skipping package version check: Branch '#{source_branch}' is not a hotfix or release branch.")
6
+ return
7
+ end
8
+
9
+ message("🔍 Running package version check for branch: #{source_branch}")
10
+
11
+ warn_list = []
12
+
13
+ # Define package-related file patterns
14
+ package_patterns = ['**/*.csproj', '**/Directory.Build.props', '**/Directory.Build.targets', '**/package.json']
15
+
16
+ # Find all matching files
17
+ package_files = Dir.glob(package_patterns, File::FNM_CASEFOLD)
18
+
19
+ if package_files.empty?
20
+ message("⚠️ No package files found! Check directory structure.")
21
+ return
22
+ end
23
+
24
+ # Regex pattern for pre-release versions
25
+ prerelease_regex = /\d+\.\d+\.\d+-.*?/i
26
+
27
+ # Scan files for pre-release package versions
28
+ package_files.each do |file|
29
+ File.readlines(file, encoding: "UTF-8").each_with_index do |line, index|
30
+ if line.match?(prerelease_regex)
31
+ cleaned_line = line.strip.gsub(/\s+/, " ") # Ensure proper spacing
32
+ warn_list << "**🚨 Pre-release package version detected** in `#{file}` (Line #{index + 1}):\n\n 👉 #{cleaned_line.inspect}"
33
+ end
34
+ end
35
+ end
36
+
37
+ # Report warnings if any
38
+ if warn_list.empty?
39
+ message("✅ No pre-release versions found.")
40
+ else
41
+ warn_list.each { |warning| warn(warning) }
42
+ end
@@ -365,6 +365,23 @@ var GitLabApiClient = /** @class */ (function () {
365
365
  });
366
366
  });
367
367
  };
368
+ GitLabApiClient.prototype.updateMergeRequestDescription = function (options) {
369
+ return __awaiter(this, void 0, void 0, function () {
370
+ var projectId, mergeRequestIid, description, updatedMR;
371
+ return __generator(this, function (_a) {
372
+ switch (_a.label) {
373
+ case 0:
374
+ projectId = options.projectId, mergeRequestIid = options.mergeRequestIid, description = options.description;
375
+ return [4 /*yield*/, this.client.MergeRequests.edit(projectId, mergeRequestIid, {
376
+ description: description,
377
+ })];
378
+ case 1:
379
+ updatedMR = _a.sent();
380
+ return [2 /*return*/, GitLabMapper_1.GitLabMapper.mergeRequest(updatedMR)];
381
+ }
382
+ });
383
+ });
384
+ };
368
385
  GitLabApiClient.prototype.getFile = function (projectId, filePath, branchName) {
369
386
  return __awaiter(this, void 0, void 0, function () {
370
387
  var file, _a;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (_) try {
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.CheckReleaseReadyCommand = void 0;
52
+ require("reflect-metadata");
53
+ var inversify_1 = require("inversify");
54
+ var types_1 = require("../types");
55
+ var CheckReleaseReadyCommand = /** @class */ (function () {
56
+ function CheckReleaseReadyCommand(checkReleaseReadyTask) {
57
+ this.checkReleaseReadyTask = checkReleaseReadyTask;
58
+ }
59
+ CheckReleaseReadyCommand.prototype.run = function (options) {
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ return __generator(this, function (_a) {
62
+ switch (_a.label) {
63
+ case 0: return [4 /*yield*/, this.checkReleaseReadyTask.run(options)];
64
+ case 1: return [2 /*return*/, _a.sent()];
65
+ }
66
+ });
67
+ });
68
+ };
69
+ CheckReleaseReadyCommand = __decorate([
70
+ (0, inversify_1.injectable)(),
71
+ __param(0, (0, inversify_1.inject)(types_1.TASKS.CheckReleaseReadyTask)),
72
+ __metadata("design:paramtypes", [Object])
73
+ ], CheckReleaseReadyCommand);
74
+ return CheckReleaseReadyCommand;
75
+ }());
76
+ exports.CheckReleaseReadyCommand = CheckReleaseReadyCommand;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
14
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
15
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -77,7 +88,7 @@ var CreateMergeRequestCommand = /** @class */ (function () {
77
88
  // Check if we want to continue with inquirer?
78
89
  if (!cont)
79
90
  return [2 /*return*/, false];
80
- return [4 /*yield*/, this.validateDescriptionsTask.run(options)];
91
+ return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { target: 'source-branch' }))];
81
92
  case 3:
82
93
  cont = _a.sent();
83
94
  if (!cont)
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
14
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
15
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -62,7 +73,7 @@ var CreateNotesAuditCommand = /** @class */ (function () {
62
73
  var cont;
63
74
  return __generator(this, function (_a) {
64
75
  switch (_a.label) {
65
- case 0: return [4 /*yield*/, this.validateDescriptionsTask.run(options)];
76
+ case 0: return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { target: 'source-branch' }))];
66
77
  case 1:
67
78
  cont = _a.sent();
68
79
  if (!cont)
@@ -73,7 +73,7 @@ var CreateReleaseNotesCommand = /** @class */ (function () {
73
73
  var cont;
74
74
  return __generator(this, function (_a) {
75
75
  switch (_a.label) {
76
- case 0: return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { slackNotifier: false }))];
76
+ case 0: return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { slackNotifier: false, target: 'source-branch' }))];
77
77
  case 1:
78
78
  cont = _a.sent();
79
79
  if (!cont)
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
14
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
15
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -80,7 +91,7 @@ var ReleaseCommand = /** @class */ (function () {
80
91
  cont = _a.sent();
81
92
  if (!cont)
82
93
  return [2 /*return*/, false];
83
- return [4 /*yield*/, this.validateDescriptionsTask.run(options)];
94
+ return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { target: 'source-branch' }))];
84
95
  case 3:
85
96
  cont = _a.sent();
86
97
  if (!cont)
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
14
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
15
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -66,7 +77,7 @@ var StatusCommand = /** @class */ (function () {
66
77
  case 0: return [4 /*yield*/, this.validateTask.run(options)];
67
78
  case 1:
68
79
  _a.sent();
69
- return [4 /*yield*/, this.validateDescriptionsTask.run(options)];
80
+ return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { target: 'source-branch' }))];
70
81
  case 2:
71
82
  _a.sent();
72
83
  return [4 /*yield*/, this.validateCommitsTask.run(options)];
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
14
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
15
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -80,7 +91,7 @@ var ToolingReleaseCommand = /** @class */ (function () {
80
91
  cont = _a.sent();
81
92
  if (!cont)
82
93
  return [2 /*return*/, false];
83
- return [4 /*yield*/, this.validateDescriptionsTask.run(options)];
94
+ return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { target: 'source-branch' }))];
84
95
  case 3:
85
96
  cont = _a.sent();
86
97
  if (!cont)
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
17
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ };
19
+ var __metadata = (this && this.__metadata) || function (k, v) {
20
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
21
+ };
22
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
23
+ return function (target, key) { decorator(target, key, paramIndex); }
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (_) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ Object.defineProperty(exports, "__esModule", { value: true });
62
+ exports.UpdateDescriptionCommand = void 0;
63
+ require("reflect-metadata");
64
+ var inversify_1 = require("inversify");
65
+ var types_1 = require("../types");
66
+ var UpdateDescriptionCommand = /** @class */ (function () {
67
+ function UpdateDescriptionCommand(validateDescriptionsTask, updateMergeRequestDescriptionTask) {
68
+ this.validateDescriptionsTask = validateDescriptionsTask;
69
+ this.updateMergeRequestDescriptionTask = updateMergeRequestDescriptionTask;
70
+ }
71
+ UpdateDescriptionCommand.prototype.run = function (options) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var cont;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0: return [4 /*yield*/, this.validateDescriptionsTask.run(__assign(__assign({}, options), { target: 'next-branch' }))];
77
+ case 1:
78
+ cont = _a.sent();
79
+ if (!cont)
80
+ return [2 /*return*/, false];
81
+ return [4 /*yield*/, this.updateMergeRequestDescriptionTask.run(options)];
82
+ case 2: return [2 /*return*/, _a.sent()];
83
+ }
84
+ });
85
+ });
86
+ };
87
+ UpdateDescriptionCommand = __decorate([
88
+ (0, inversify_1.injectable)(),
89
+ __param(0, (0, inversify_1.inject)(types_1.TASKS.ValidateDescriptionsTask)),
90
+ __param(1, (0, inversify_1.inject)(types_1.TASKS.UpdateMergeRequestDescriptionTask)),
91
+ __metadata("design:paramtypes", [Object, Object])
92
+ ], UpdateDescriptionCommand);
93
+ return UpdateDescriptionCommand;
94
+ }());
95
+ exports.UpdateDescriptionCommand = UpdateDescriptionCommand;
@@ -31,3 +31,4 @@ __exportStar(require("./ValidateMergeRequestCommand"), exports);
31
31
  __exportStar(require("./VersionCommand"), exports);
32
32
  __exportStar(require("./CreateTrelloCardsCommand"), exports);
33
33
  __exportStar(require("./CreateHotfixCommand"), exports);
34
+ __exportStar(require("./UpdateDescriptionCommand"), exports);
@@ -19,5 +19,6 @@ exports.CommandTypeMapping = {
19
19
  'list-projects': types_1.COMMANDS.ListProjectsCommand,
20
20
  'create-trello-cards': types_1.COMMANDS.CreateTrelloCardsCommand,
21
21
  'configure-projects': types_1.COMMANDS.ConfigureProjectsCommand,
22
- 'create-hotfix': types_1.COMMANDS.CreateHotfixCommand
22
+ 'create-hotfix': types_1.COMMANDS.CreateHotfixCommand,
23
+ 'update-description': types_1.COMMANDS.UpdateDescriptionCommand
23
24
  };
package/lib/src/index.js CHANGED
File without changes
@@ -58,6 +58,9 @@ function createContainer(config) {
58
58
  container.bind(types_1.TASKS.CreateToolingBranchTask).to(tasks_1.CreateToolingBranchTask);
59
59
  container.bind(types_1.TASKS.CreateHotfixTask).to(tasks_1.CreateHotfixTask);
60
60
  container.bind(types_1.TASKS.ChangeMilestoneTask).to(ChangeMilestoneTask_1.ChangeMilestoneTask);
61
+ container
62
+ .bind(types_1.TASKS.UpdateMergeRequestDescriptionTask)
63
+ .to(tasks_1.UpdateMergeRequestDescriptionTask);
61
64
  /**
62
65
  * Commands
63
66
  */
@@ -79,6 +82,7 @@ function createContainer(config) {
79
82
  .to(commands_1.StartProjectBuildsCommand);
80
83
  container.bind(types_1.COMMANDS.ConfigureProjectsCommand).to(commands_1.ConfigureProjectsCommand);
81
84
  container.bind(types_1.COMMANDS.CreateHotfixCommand).to(commands_1.CreateHotfixCommand);
85
+ container.bind(types_1.COMMANDS.UpdateDescriptionCommand).to(commands_1.UpdateDescriptionCommand);
82
86
  return container;
83
87
  }
84
88
  exports.createContainer = createContainer;
@@ -311,6 +311,19 @@ var GitLabService = /** @class */ (function () {
311
311
  GitLabService.prototype.AcceptMergeRequest = function (projectId, mergerequestIId) {
312
312
  return this.apiClient.AcceptMergeRequest(projectId, mergerequestIId);
313
313
  };
314
+ GitLabService.prototype.updateMergeRequestDescription = function (options) {
315
+ return __awaiter(this, void 0, void 0, function () {
316
+ var projectId, mergeRequestIid, description;
317
+ return __generator(this, function (_a) {
318
+ projectId = options.projectId, mergeRequestIid = options.mergeRequestIid, description = options.description;
319
+ return [2 /*return*/, this.apiClient.updateMergeRequestDescription({
320
+ projectId: projectId,
321
+ mergeRequestIid: mergeRequestIid,
322
+ description: description
323
+ })];
324
+ });
325
+ });
326
+ };
314
327
  GitLabService.prototype.getMilestone = function (milestoneName, projectId) {
315
328
  return this.apiClient.getMilestone(milestoneName, projectId);
316
329
  };
@@ -62,6 +62,7 @@ function setupCommands(program, container) {
62
62
  addMilestoneCommand('create-notes-audit', 'Builds a spreadsheet of all the customer changes and who wrote them.');
63
63
  addMilestoneCommand('tag-master', 'Tags master for all release MRs that are part of a milestone');
64
64
  addMilestoneCommand('create-trello-cards', 'Creates the cards on the ship-it trello board for all projects that are part of a milestone');
65
+ addMilestoneCommand('update-description', 'Recreates descriptions for release MRs');
65
66
  program.command('status')
66
67
  .description('Get the status of all MRs in a milestone')
67
68
  .requiredOption('-m, --milestone <milestone>')
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (_) try {
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.CheckReleaseReadyTask = void 0;
52
+ require("reflect-metadata");
53
+ var inversify_1 = require("inversify");
54
+ var Logger_1 = require("../utils/Logger");
55
+ var types_1 = require("../types");
56
+ var services_1 = require("../services");
57
+ var utils_1 = require("../utils");
58
+ var CheckReleaseReadyTask = /** @class */ (function () {
59
+ function CheckReleaseReadyTask(service, slackService, trelloService) {
60
+ this.service = service;
61
+ this.slackService = slackService;
62
+ this.trelloService = trelloService;
63
+ }
64
+ CheckReleaseReadyTask.prototype.run = function (options) {
65
+ return __awaiter(this, void 0, void 0, function () {
66
+ var projects, _i, projects_1, project, _a, branchName, nextVersion, mergeRequest, description, owner;
67
+ return __generator(this, function (_b) {
68
+ switch (_b.label) {
69
+ case 0:
70
+ Logger_1.Logger.logTask('Checking status of the current release...');
71
+ return [4 /*yield*/, this.service.getProjects(options.milestone, options.projectIds, options.omittedProjectIds)];
72
+ case 1:
73
+ projects = _b.sent();
74
+ // let cont = true;
75
+ // let logMessageSlack = '';
76
+ Logger_1.Logger.logInfo('Here are all the Before Release Tasks');
77
+ _i = 0, projects_1 = projects;
78
+ _b.label = 2;
79
+ case 2:
80
+ if (!(_i < projects_1.length)) return [3 /*break*/, 7];
81
+ project = projects_1[_i];
82
+ return [4 /*yield*/, this.service.getNextBranchInfo(project.id, options.version)];
83
+ case 3:
84
+ _a = _b.sent(), branchName = _a.branchName, nextVersion = _a.nextVersion;
85
+ return [4 /*yield*/, this.service.getMergeRequest(project.id, branchName)];
86
+ case 4:
87
+ mergeRequest = _b.sent();
88
+ if (!mergeRequest) {
89
+ return [3 /*break*/, 6];
90
+ }
91
+ description = utils_1.Descriptions.getDescriptionSection('BeforeRelease', mergeRequest);
92
+ if (!description) {
93
+ return [3 /*break*/, 6];
94
+ }
95
+ return [4 /*yield*/, this.trelloService.getMember(mergeRequest.url)];
96
+ case 5:
97
+ owner = _b.sent();
98
+ Logger_1.Logger.logMessage(project.title, mergeRequest.title, owner);
99
+ Logger_1.Logger.logMessage(description);
100
+ _b.label = 6;
101
+ case 6:
102
+ _i++;
103
+ return [3 /*break*/, 2];
104
+ case 7: return [2 /*return*/, true];
105
+ }
106
+ });
107
+ });
108
+ };
109
+ CheckReleaseReadyTask = __decorate([
110
+ (0, inversify_1.injectable)(),
111
+ __param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
112
+ __param(1, (0, inversify_1.inject)(types_1.SERVICES.SlackService)),
113
+ __param(2, (0, inversify_1.inject)(types_1.SERVICES.TrelloService)),
114
+ __metadata("design:paramtypes", [services_1.GitLabService,
115
+ services_1.SlackService,
116
+ services_1.TrelloService])
117
+ ], CheckReleaseReadyTask);
118
+ return CheckReleaseReadyTask;
119
+ }());
120
+ exports.CheckReleaseReadyTask = CheckReleaseReadyTask;
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (_) try {
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.UpdateMergeRequestDescriptionTask = void 0;
52
+ require("reflect-metadata");
53
+ var inversify_1 = require("inversify");
54
+ var types_1 = require("../types");
55
+ var services_1 = require("../services");
56
+ var utils_1 = require("../utils");
57
+ var UpdateMergeRequestDescriptionTask = /** @class */ (function () {
58
+ function UpdateMergeRequestDescriptionTask(service) {
59
+ this.service = service;
60
+ }
61
+ UpdateMergeRequestDescriptionTask.prototype.run = function (options) {
62
+ return __awaiter(this, void 0, void 0, function () {
63
+ var projects, _i, projects_1, project, _a, branch, branchName, mergeRequest, projectConfig, description;
64
+ return __generator(this, function (_b) {
65
+ switch (_b.label) {
66
+ case 0:
67
+ utils_1.Logger.logTask('Updating Merge Requests Descriptions');
68
+ return [4 /*yield*/, this.service.getReleaseProjects(options.milestone, options.projectIds, options.omittedProjectIds, options.sourceBranch)];
69
+ case 1:
70
+ projects = _b.sent();
71
+ _i = 0, projects_1 = projects;
72
+ _b.label = 2;
73
+ case 2:
74
+ if (!(_i < projects_1.length)) return [3 /*break*/, 8];
75
+ project = projects_1[_i];
76
+ return [4 /*yield*/, this.service.getNextBranchInfo(project.id, options.version)];
77
+ case 3:
78
+ _a = _b.sent(), branch = _a.branch, branchName = _a.branchName;
79
+ if (!branch) {
80
+ utils_1.Logger.logError("[".concat(project.title, "]: [").concat(branchName, "] does not exist"));
81
+ return [3 /*break*/, 7];
82
+ }
83
+ return [4 /*yield*/, this.service.getMergeRequest(project.id, branchName, 'opened')];
84
+ case 4:
85
+ mergeRequest = _b.sent();
86
+ if (!mergeRequest) {
87
+ utils_1.Logger.logWarning("[".concat(project.title, "]: MR does not exist"));
88
+ return [3 /*break*/, 7];
89
+ }
90
+ return [4 /*yield*/, this.service.getProjectConfig(project.id, options.sourceBranch)];
91
+ case 5:
92
+ projectConfig = _b.sent();
93
+ description = projectConfig.monorepo.enabled ?
94
+ utils_1.Descriptions.getMonorepoCombinedDescription(project.mergeRequests) :
95
+ utils_1.Descriptions.getCombinedDescription(project.mergeRequests);
96
+ return [4 /*yield*/, this.service.updateMergeRequestDescription({
97
+ projectId: project.id,
98
+ mergeRequestIid: mergeRequest.iid,
99
+ description: description
100
+ })];
101
+ case 6:
102
+ mergeRequest = _b.sent();
103
+ utils_1.Logger.logMessage("[".concat(project.title, "]: MR description updated"));
104
+ utils_1.Logger.logInfo(mergeRequest.url);
105
+ _b.label = 7;
106
+ case 7:
107
+ _i++;
108
+ return [3 /*break*/, 2];
109
+ case 8: return [2 /*return*/, true];
110
+ }
111
+ });
112
+ });
113
+ };
114
+ UpdateMergeRequestDescriptionTask = __decorate([
115
+ (0, inversify_1.injectable)(),
116
+ __param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
117
+ __metadata("design:paramtypes", [services_1.GitLabService])
118
+ ], UpdateMergeRequestDescriptionTask);
119
+ return UpdateMergeRequestDescriptionTask;
120
+ }());
121
+ exports.UpdateMergeRequestDescriptionTask = UpdateMergeRequestDescriptionTask;
@@ -66,66 +66,86 @@ var ValidateDescriptionsTask = /** @class */ (function () {
66
66
  ValidateDescriptionsTask.prototype.run = function (options) {
67
67
  var _a;
68
68
  return __awaiter(this, void 0, void 0, function () {
69
- var projects, cont, allInvalidDescriptionsMessage, emailList, _i, projects_1, project, invalidMrs, mergeRequestsTargetingSource, projectConfig, isMonorepo, _b, mergeRequestsTargetingSource_1, mr, errors, isMrValid, projectErrorMessage, groupedByUser, key, authorEmail, _c, _d, _e, mr, errors, _f, errors_1, error, threadLabel, statusCleanMessage;
70
- return __generator(this, function (_g) {
71
- switch (_g.label) {
69
+ var projects, cont, allInvalidDescriptionsMessage, emailList, _loop_1, this_1, _i, projects_1, project, threadLabel, statusCleanMessage;
70
+ return __generator(this, function (_b) {
71
+ switch (_b.label) {
72
72
  case 0:
73
73
  utils_1.Logger.logTask('Validating descriptions');
74
74
  return [4 /*yield*/, this.gitLabService.getReleaseProjects(options.milestone, options.projectIds, options.omittedProjectIds, options.sourceBranch)];
75
75
  case 1:
76
- projects = _g.sent();
76
+ projects = _b.sent();
77
77
  cont = true;
78
78
  allInvalidDescriptionsMessage = '';
79
79
  emailList = [];
80
+ _loop_1 = function (project) {
81
+ var invalidMrs, targetBranch, mergeRequestsTargetingSource, projectConfig, isMonorepo, _c, mergeRequestsTargetingSource_1, mr, errors, isMrValid, projectErrorMessage, groupedByUser, key, authorEmail, _d, _e, _f, mr, errors, _g, errors_1, error;
82
+ return __generator(this, function (_h) {
83
+ switch (_h.label) {
84
+ case 0:
85
+ invalidMrs = [];
86
+ return [4 /*yield*/, this_1.getTargetBranch(project, options)];
87
+ case 1:
88
+ targetBranch = _h.sent();
89
+ if (!targetBranch) {
90
+ utils_1.Logger.logWarning("[".concat(project.title, "]: Skipping due to missing target branch"));
91
+ return [2 /*return*/, "continue"];
92
+ }
93
+ mergeRequestsTargetingSource = project.mergeRequests.filter(function (mergeRequest) {
94
+ return mergeRequest.targetBranch === targetBranch;
95
+ });
96
+ return [4 /*yield*/, this_1.gitLabService.getProjectConfig(project.id, options.sourceBranch)];
97
+ case 2:
98
+ projectConfig = _h.sent();
99
+ isMonorepo = project.id.toString() === utils_1.ProjectIds.MONOREPO_PROJECT_ID;
100
+ for (_c = 0, mergeRequestsTargetingSource_1 = mergeRequestsTargetingSource; _c < mergeRequestsTargetingSource_1.length; _c++) {
101
+ mr = mergeRequestsTargetingSource_1[_c];
102
+ errors = utils_1.Descriptions.validate(mr.description, projectConfig);
103
+ isMrValid = errors.length === 0;
104
+ if (isMonorepo && !((_a = mr.labels) === null || _a === void 0 ? void 0 : _a.length))
105
+ isMrValid = false;
106
+ if (!isMrValid)
107
+ invalidMrs.push([mr, errors]);
108
+ }
109
+ if (invalidMrs.length) {
110
+ utils_1.Logger.logError("\n[".concat(project.title, "] has invalid MRs"));
111
+ projectErrorMessage = "[".concat(project.title, "] has invalid MRs");
112
+ allInvalidDescriptionsMessage += "\n".concat(projectErrorMessage);
113
+ groupedByUser = lodash_1.default.groupBy(invalidMrs, function (_a) {
114
+ var mr = _a[0];
115
+ return mr.author;
116
+ });
117
+ for (key in groupedByUser) {
118
+ utils_1.Logger.logMessage(key);
119
+ authorEmail = this_1.slackService.convertToEmailFormat(key);
120
+ emailList.push(authorEmail);
121
+ allInvalidDescriptionsMessage += "\n".concat(key);
122
+ for (_d = 0, _e = groupedByUser[key]; _d < _e.length; _d++) {
123
+ _f = _e[_d], mr = _f[0], errors = _f[1];
124
+ utils_1.Logger.logMessage("- ".concat(mr.url));
125
+ allInvalidDescriptionsMessage += "\n- ".concat(mr.url);
126
+ for (_g = 0, errors_1 = errors; _g < errors_1.length; _g++) {
127
+ error = errors_1[_g];
128
+ utils_1.Logger.logMessage(" - ".concat(error));
129
+ allInvalidDescriptionsMessage += "\n - ".concat(error);
130
+ }
131
+ }
132
+ }
133
+ cont = false;
134
+ }
135
+ return [2 /*return*/];
136
+ }
137
+ });
138
+ };
139
+ this_1 = this;
80
140
  _i = 0, projects_1 = projects;
81
- _g.label = 2;
141
+ _b.label = 2;
82
142
  case 2:
83
143
  if (!(_i < projects_1.length)) return [3 /*break*/, 5];
84
144
  project = projects_1[_i];
85
- invalidMrs = [];
86
- mergeRequestsTargetingSource = project.mergeRequests.filter(function (mergeRequest) {
87
- return mergeRequest.targetBranch === options.sourceBranch;
88
- });
89
- return [4 /*yield*/, this.gitLabService.getProjectConfig(project.id, options.sourceBranch)];
145
+ return [5 /*yield**/, _loop_1(project)];
90
146
  case 3:
91
- projectConfig = _g.sent();
92
- isMonorepo = project.id.toString() === utils_1.ProjectIds.MONOREPO_PROJECT_ID;
93
- for (_b = 0, mergeRequestsTargetingSource_1 = mergeRequestsTargetingSource; _b < mergeRequestsTargetingSource_1.length; _b++) {
94
- mr = mergeRequestsTargetingSource_1[_b];
95
- errors = utils_1.Descriptions.validate(mr.description, projectConfig);
96
- isMrValid = errors.length === 0;
97
- if (isMonorepo && !((_a = mr.labels) === null || _a === void 0 ? void 0 : _a.length))
98
- isMrValid = false;
99
- if (!isMrValid)
100
- invalidMrs.push([mr, errors]);
101
- }
102
- if (invalidMrs.length) {
103
- utils_1.Logger.logError("\n[".concat(project.title, "] has invalid MRs"));
104
- projectErrorMessage = "[".concat(project.title, "] has invalid MRs");
105
- allInvalidDescriptionsMessage += "\n".concat(projectErrorMessage);
106
- groupedByUser = lodash_1.default.groupBy(invalidMrs, function (_a) {
107
- var mr = _a[0];
108
- return mr.author;
109
- });
110
- for (key in groupedByUser) {
111
- utils_1.Logger.logMessage(key);
112
- authorEmail = this.slackService.convertToEmailFormat(key);
113
- emailList.push(authorEmail);
114
- allInvalidDescriptionsMessage += "\n".concat(key);
115
- for (_c = 0, _d = groupedByUser[key]; _c < _d.length; _c++) {
116
- _e = _d[_c], mr = _e[0], errors = _e[1];
117
- utils_1.Logger.logMessage("- ".concat(mr.url));
118
- allInvalidDescriptionsMessage += "\n- ".concat(mr.url);
119
- for (_f = 0, errors_1 = errors; _f < errors_1.length; _f++) {
120
- error = errors_1[_f];
121
- utils_1.Logger.logMessage(" - ".concat(error));
122
- allInvalidDescriptionsMessage += "\n - ".concat(error);
123
- }
124
- }
125
- }
126
- cont = false;
127
- }
128
- _g.label = 4;
147
+ _b.sent();
148
+ _b.label = 4;
129
149
  case 4:
130
150
  _i++;
131
151
  return [3 /*break*/, 2];
@@ -142,8 +162,8 @@ var ValidateDescriptionsTask = /** @class */ (function () {
142
162
  })];
143
163
  case 6:
144
164
  // Send formated status update in slack
145
- _g.sent();
146
- _g.label = 7;
165
+ _b.sent();
166
+ _b.label = 7;
147
167
  case 7:
148
168
  if (cont)
149
169
  utils_1.Logger.logSuccess('All MR descriptions are valid');
@@ -152,6 +172,26 @@ var ValidateDescriptionsTask = /** @class */ (function () {
152
172
  });
153
173
  });
154
174
  };
175
+ ValidateDescriptionsTask.prototype.getTargetBranch = function (project, options) {
176
+ return __awaiter(this, void 0, void 0, function () {
177
+ var _a, branch, branchName;
178
+ return __generator(this, function (_b) {
179
+ switch (_b.label) {
180
+ case 0:
181
+ if (options.target === 'source-branch') {
182
+ return [2 /*return*/, options.sourceBranch];
183
+ }
184
+ return [4 /*yield*/, this.gitLabService.getNextBranchInfo(project.id, options.version)];
185
+ case 1:
186
+ _a = _b.sent(), branch = _a.branch, branchName = _a.branchName;
187
+ if (!branch) {
188
+ utils_1.Logger.logError("[".concat(project.title, "]: [").concat(branchName, "] does not exist"));
189
+ }
190
+ return [2 /*return*/, branchName];
191
+ }
192
+ });
193
+ });
194
+ };
155
195
  ValidateDescriptionsTask = __decorate([
156
196
  (0, inversify_1.injectable)(),
157
197
  __param(0, (0, inversify_1.inject)(types_1.SERVICES.GitLabService)),
@@ -33,3 +33,4 @@ __exportStar(require("./ValidateTask"), exports);
33
33
  __exportStar(require("./VersionTask"), exports);
34
34
  __exportStar(require("./PopulateTrelloBoardTask"), exports);
35
35
  __exportStar(require("./CreateHotfixTask"), exports);
36
+ __exportStar(require("./UpdateMergeRequestDescriptionTask"), exports);
package/lib/src/types.js CHANGED
@@ -42,6 +42,7 @@ exports.TASKS = {
42
42
  EnsureApprovalRulesTask: Symbol.for('EnsureApprovalRulesTask'),
43
43
  CreateHotfixTask: Symbol.for('CreateHotfixTask'),
44
44
  ChangeMilestoneTask: Symbol.for('ChangeMilestoneTask'),
45
+ UpdateMergeRequestDescriptionTask: Symbol.for('UpdateMergeRequestDescriptionTask')
45
46
  };
46
47
  exports.COMMANDS = {
47
48
  StatusCommand: Symbol.for('StatusCommand'),
@@ -60,5 +61,6 @@ exports.COMMANDS = {
60
61
  ListProjectsCommand: Symbol.for('ListProjectsCommand'),
61
62
  CreateTrelloCardsCommand: Symbol.for('CreateTrelloCardsCommand'),
62
63
  ConfigureProjectsCommand: Symbol.for('ConfigureProjectsCommand'),
63
- CreateHotfixCommand: Symbol.for('CreateHotfixCommand')
64
+ CreateHotfixCommand: Symbol.for('CreateHotfixCommand'),
65
+ UpdateDescriptionCommand: Symbol.for('UpdateDescriptionCommand')
64
66
  };
@@ -2,35 +2,53 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Descriptions = void 0;
4
4
  var Headings = {
5
- BeforeRelease: 'Before release',
6
- Dependencies: 'Dependencies',
7
- CodeChanges: 'Code changes',
8
- CustomerChanges: 'Customer changes',
5
+ BeforeRelease: 'Before Release',
6
+ AfterRelease: 'After Release',
7
+ Dependencies: 'Deploy Dependencies',
8
+ CodeChanges: 'Code Changes',
9
+ CustomerChanges: 'Customer Changes',
9
10
  Testing: 'Testing',
10
- Notes: 'Notes'
11
+ Notes: 'Notes',
12
+ MergeRequestChecklist: 'Merge Request Checklist',
13
+ Tasks: 'Tasks',
14
+ SQL: 'SQL',
11
15
  };
12
16
  var BASE_VALID_HEADINGS = [
13
17
  Headings.BeforeRelease,
18
+ Headings.AfterRelease,
14
19
  Headings.Dependencies,
15
20
  Headings.Testing,
16
- Headings.Notes
21
+ Headings.Notes,
22
+ Headings.MergeRequestChecklist
17
23
  ];
18
24
  var PROJECT_VALID_HEADINGS = BASE_VALID_HEADINGS.concat([
19
25
  Headings.CustomerChanges,
20
26
  Headings.CodeChanges
21
27
  ]);
22
28
  var PROJECT_REQUIRED_HEADINGS = [
23
- Headings.Testing
29
+ Headings.Testing,
30
+ Headings.MergeRequestChecklist
24
31
  ];
25
32
  var HEADING_ORDER = [
26
- Headings.BeforeRelease,
27
33
  Headings.Dependencies,
34
+ Headings.BeforeRelease,
35
+ Headings.AfterRelease,
28
36
  Headings.CustomerChanges,
29
37
  Headings.CodeChanges,
30
38
  '*',
31
39
  Headings.Testing,
32
40
  Headings.Notes,
33
41
  ];
42
+ var IGNORED_HEADINGS = [Headings.MergeRequestChecklist];
43
+ var SPECIAL_HEADINGS = [
44
+ Headings.BeforeRelease,
45
+ Headings.AfterRelease,
46
+ ];
47
+ var GROUPED_SUBHEADINGS = [
48
+ Headings.Tasks,
49
+ Headings.SQL,
50
+ ];
51
+ var MERGE_REQUEST_CHECKLIST = "\n# Merge Request Checklist\n- [ ] QA validation is completed.\n- [ ] All dependencies have been addressed.\n- [ ] All before release tasks have been completed.\n- [ ] All after release tasks are ready to be completed.";
34
52
  function headingTransformer(heading) {
35
53
  // Fix casing of known headings
36
54
  var lowerHeading = heading.toLowerCase();
@@ -143,12 +161,24 @@ exports.Descriptions = {
143
161
  // Ensure all the headings are valid
144
162
  for (var _i = 0, headings_1 = headings; _i < headings_1.length; _i++) {
145
163
  var heading = headings_1[_i];
164
+ if (IGNORED_HEADINGS.includes(heading))
165
+ continue;
146
166
  if (options.validSections.indexOf(heading) === -1)
147
167
  errors.push("Invalid section: ".concat(heading));
168
+ if (SPECIAL_HEADINGS.includes(heading)) {
169
+ var subObj = toObject(parsedDescription[heading].split('\n'), '##');
170
+ var subHeadings = Object.keys(subObj);
171
+ for (var _a = 0, subHeadings_1 = subHeadings; _a < subHeadings_1.length; _a++) {
172
+ var subHeading = subHeadings_1[_a];
173
+ if (!GROUPED_SUBHEADINGS.includes(subHeading)) {
174
+ errors.push("Invalid sub-section '".concat(subHeading, "' in '").concat(heading, "'"));
175
+ }
176
+ }
177
+ }
148
178
  }
149
179
  // Ensure we have all required headings
150
- for (var _a = 0, _b = options.requiredSections; _a < _b.length; _a++) {
151
- var requiredSection = _b[_a];
180
+ for (var _b = 0, _c = options.requiredSections; _b < _c.length; _b++) {
181
+ var requiredSection = _c[_b];
152
182
  if (parsedDescription[requiredSection] === undefined)
153
183
  errors.push("Missing section: ".concat(requiredSection));
154
184
  }
@@ -162,9 +192,24 @@ exports.Descriptions = {
162
192
  var obj = {};
163
193
  var _loop_2 = function (descriptionObj) {
164
194
  Object.keys(descriptionObj).forEach(function (key) {
165
- if (!obj[key])
166
- obj[key] = '';
167
- obj[key] += descriptionObj[key] + '\n';
195
+ if (!SPECIAL_HEADINGS.includes(key)) {
196
+ if (!obj[key])
197
+ obj[key] = ''; // Keep as string for regular headings
198
+ obj[key] += String(descriptionObj[key]) + '\n';
199
+ return;
200
+ }
201
+ // For special headings, initialise as an object
202
+ if (!obj[key] || typeof obj[key] === 'string') {
203
+ obj[key] = {};
204
+ }
205
+ var subObj = toObject(descriptionObj[key].split('\n'), headingPrefix + '#');
206
+ Object.keys(subObj).forEach(function (subKey) {
207
+ if (!obj[key][subKey])
208
+ obj[key][subKey] = '';
209
+ obj[key][subKey] += subObj[subKey];
210
+ if (GROUPED_SUBHEADINGS.includes(subKey))
211
+ obj[key][subKey] += '\n';
212
+ });
168
213
  });
169
214
  };
170
215
  for (var _i = 0, descriptionObjs_1 = descriptionObjs; _i < descriptionObjs_1.length; _i++) {
@@ -172,15 +217,24 @@ exports.Descriptions = {
172
217
  _loop_2(descriptionObj);
173
218
  }
174
219
  var description = '';
175
- var orderedHeadings = orderDescriptionHeadings(Object.keys(obj));
220
+ var orderedHeadings = orderDescriptionHeadings(Object.keys(obj).filter(function (h) { return !IGNORED_HEADINGS.includes(h); }));
176
221
  orderedHeadings.forEach(function (key) {
177
222
  if (key === Headings.Notes)
178
223
  return;
179
224
  if (!obj[key])
180
225
  return;
181
226
  description += '\n' + headingPrefix + ' ' + key + '\n';
182
- description += obj[key];
227
+ if (!SPECIAL_HEADINGS.includes(key)) {
228
+ description += obj[key];
229
+ return;
230
+ }
231
+ // Process subheadings within "Before Release" and "After Release"
232
+ Object.keys(obj[key]).forEach(function (subKey) {
233
+ description += '\n' + headingPrefix + '#' + ' ' + subKey + '\n';
234
+ description += obj[key][subKey];
235
+ });
183
236
  });
237
+ description += MERGE_REQUEST_CHECKLIST;
184
238
  return description;
185
239
  },
186
240
  getDescriptionSection: function (heading, mergeRequest) {
@@ -206,10 +260,22 @@ exports.Descriptions = {
206
260
  combinedObj[key] = {};
207
261
  var combinedSubObj = toObject(descriptionObj[key].split('\n'), '##');
208
262
  var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedSubObj));
263
+ if (!SPECIAL_HEADINGS.includes(key)) {
264
+ // Regular headings (not BeforeRelease or AfterRelease)
265
+ orderedHeadings.forEach(function (subKey) {
266
+ if (!combinedObj[key][subKey]) {
267
+ combinedObj[key][subKey] = '';
268
+ }
269
+ combinedObj[key][subKey] += combinedSubObj[subKey];
270
+ });
271
+ return;
272
+ }
209
273
  orderedHeadings.forEach(function (subKey) {
210
274
  if (!combinedObj[key][subKey])
211
275
  combinedObj[key][subKey] = '';
212
276
  combinedObj[key][subKey] += combinedSubObj[subKey];
277
+ if (GROUPED_SUBHEADINGS.includes(subKey))
278
+ combinedObj[key][subKey] += '\n';
213
279
  });
214
280
  });
215
281
  };
@@ -218,7 +284,7 @@ exports.Descriptions = {
218
284
  var descriptionObj = descriptionObjs_2[_i];
219
285
  _loop_3(descriptionObj);
220
286
  }
221
- var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedObj));
287
+ var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedObj).filter(function (h) { return !IGNORED_HEADINGS.includes(h); }));
222
288
  // Build our description
223
289
  var description = '';
224
290
  orderedHeadings.forEach(function (key) {
@@ -226,11 +292,11 @@ exports.Descriptions = {
226
292
  return;
227
293
  description += '\n# ' + key + '\n';
228
294
  Object.keys(combinedObj[key]).forEach(function (subKey) {
229
- if (key !== Headings.Dependencies && key !== Headings.Testing)
230
- description += '\n## ' + subKey + '\n';
295
+ description += '\n## ' + subKey + '\n';
231
296
  description += combinedObj[key][subKey];
232
297
  });
233
298
  });
299
+ description += MERGE_REQUEST_CHECKLIST;
234
300
  return description;
235
301
  },
236
302
  getMonorepoDescriptionSection: function (subHeading, mergeRequest) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.43-rc.2",
3
+ "version": "0.0.44",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {