From b4065540f8dce1351b6a485e0932a887173acd86 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Wed, 15 Jun 2022 18:25:08 +1200 Subject: [PATCH 01/17] fix: slugify repo and branch --- .editorconfig | 11 + .eslintrc.js | 2 +- .prettierignore | 7 + dist/index.js | 761 +++++++++++++++++++++++++++++++++++++++++++++- package-lock.json | 301 ++++++++++++++++++ package.json | 1 + src/github.js | 8 +- src/index.js | 12 +- 8 files changed, 1086 insertions(+), 17 deletions(-) create mode 100644 .editorconfig create mode 100644 .prettierignore diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..450e4146 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# See https://prettier.io/docs/en/configuration.html#editorconfig + +# Stop the editor from looking for .editorconfig files in the parent directories +root = true + +[*] +charset = utf-8 +insert_final_newline = false +indent_style = tab +indent_size = 2 +max_line_length = 100 diff --git a/.eslintrc.js b/.eslintrc.js index 43a3ad8c..3d50a727 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1 +1 @@ -module.exports = require('@betahuhn/config').eslint \ No newline at end of file +module.exports = require('@betahuhn/config').eslint diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..b75736bc --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +src +dist +.github +*.js +*.yml +*.md +*.json diff --git a/dist/index.js b/dist/index.js index 96404ca1..9401a3ed 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6506,6 +6506,81 @@ CacheableRequest.CacheError = class extends Error { module.exports = CacheableRequest; +/***/ }), + +/***/ 3638: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.camelCase = exports.camelCaseTransformMerge = exports.camelCaseTransform = void 0; +var tslib_1 = __nccwpck_require__(9679); +var pascal_case_1 = __nccwpck_require__(5995); +function camelCaseTransform(input, index) { + if (index === 0) + return input.toLowerCase(); + return pascal_case_1.pascalCaseTransform(input, index); +} +exports.camelCaseTransform = camelCaseTransform; +function camelCaseTransformMerge(input, index) { + if (index === 0) + return input.toLowerCase(); + return pascal_case_1.pascalCaseTransformMerge(input); +} +exports.camelCaseTransformMerge = camelCaseTransformMerge; +function camelCase(input, options) { + if (options === void 0) { options = {}; } + return pascal_case_1.pascalCase(input, tslib_1.__assign({ transform: camelCaseTransform }, options)); +} +exports.camelCase = camelCase; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 8824: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.capitalCase = exports.capitalCaseTransform = void 0; +var tslib_1 = __nccwpck_require__(9679); +var no_case_1 = __nccwpck_require__(6613); +var upper_case_first_1 = __nccwpck_require__(6256); +function capitalCaseTransform(input) { + return upper_case_first_1.upperCaseFirst(input.toLowerCase()); +} +exports.capitalCaseTransform = capitalCaseTransform; +function capitalCase(input, options) { + if (options === void 0) { options = {}; } + return no_case_1.noCase(input, tslib_1.__assign({ delimiter: " ", transform: capitalCaseTransform }, options)); +} +exports.capitalCase = capitalCase; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 9091: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __nccwpck_require__(9679); +tslib_1.__exportStar(__nccwpck_require__(3638), exports); +tslib_1.__exportStar(__nccwpck_require__(8824), exports); +tslib_1.__exportStar(__nccwpck_require__(6878), exports); +tslib_1.__exportStar(__nccwpck_require__(2246), exports); +tslib_1.__exportStar(__nccwpck_require__(3657), exports); +tslib_1.__exportStar(__nccwpck_require__(6613), exports); +tslib_1.__exportStar(__nccwpck_require__(8452), exports); +tslib_1.__exportStar(__nccwpck_require__(5995), exports); +tslib_1.__exportStar(__nccwpck_require__(3553), exports); +tslib_1.__exportStar(__nccwpck_require__(9229), exports); +tslib_1.__exportStar(__nccwpck_require__(6213), exports); +//# sourceMappingURL=index.js.map + /***/ }), /***/ 1312: @@ -6531,6 +6606,25 @@ const cloneResponse = response => { module.exports = cloneResponse; +/***/ }), + +/***/ 6878: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.constantCase = void 0; +var tslib_1 = __nccwpck_require__(9679); +var no_case_1 = __nccwpck_require__(6613); +var upper_case_1 = __nccwpck_require__(5997); +function constantCase(input, options) { + if (options === void 0) { options = {}; } + return no_case_1.noCase(input, tslib_1.__assign({ delimiter: "_", transform: upper_case_1.upperCase }, options)); +} +exports.constantCase = constantCase; +//# sourceMappingURL=index.js.map + /***/ }), /***/ 2391: @@ -6765,6 +6859,24 @@ class Deprecation extends Error { exports.Deprecation = Deprecation; +/***/ }), + +/***/ 2246: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.dotCase = void 0; +var tslib_1 = __nccwpck_require__(9679); +var no_case_1 = __nccwpck_require__(6613); +function dotCase(input, options) { + if (options === void 0) { options = {}; } + return no_case_1.noCase(input, tslib_1.__assign({ delimiter: "." }, options)); +} +exports.dotCase = dotCase; +//# sourceMappingURL=index.js.map + /***/ }), /***/ 2437: @@ -9916,6 +10028,24 @@ exports["default"] = (message) => { }; +/***/ }), + +/***/ 3657: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.headerCase = void 0; +var tslib_1 = __nccwpck_require__(9679); +var capital_case_1 = __nccwpck_require__(8824); +function headerCase(input, options) { + if (options === void 0) { options = {}; } + return capital_case_1.capitalCase(input, tslib_1.__assign({ delimiter: "-" }, options)); +} +exports.headerCase = headerCase; +//# sourceMappingURL=index.js.map + /***/ }), /***/ 1002: @@ -12503,6 +12633,66 @@ class Keyv extends EventEmitter { module.exports = Keyv; +/***/ }), + +/***/ 8387: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.lowerCase = exports.localeLowerCase = void 0; +/** + * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt + */ +var SUPPORTED_LOCALE = { + tr: { + regexp: /\u0130|\u0049|\u0049\u0307/g, + map: { + İ: "\u0069", + I: "\u0131", + İ: "\u0069", + }, + }, + az: { + regexp: /\u0130/g, + map: { + İ: "\u0069", + I: "\u0131", + İ: "\u0069", + }, + }, + lt: { + regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, + map: { + I: "\u0069\u0307", + J: "\u006A\u0307", + Į: "\u012F\u0307", + Ì: "\u0069\u0307\u0300", + Í: "\u0069\u0307\u0301", + Ĩ: "\u0069\u0307\u0303", + }, + }, +}; +/** + * Localized lower case. + */ +function localeLowerCase(str, locale) { + var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; + if (lang) + return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); + return lowerCase(str); +} +exports.localeLowerCase = localeLowerCase; +/** + * Lower case as a function. + */ +function lowerCase(str) { + return str.toLowerCase(); +} +exports.lowerCase = lowerCase; +//# sourceMappingURL=index.js.map + /***/ }), /***/ 9662: @@ -12561,6 +12751,48 @@ module.exports = (fromStream, toStream) => { }; +/***/ }), + +/***/ 6613: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.noCase = void 0; +var lower_case_1 = __nccwpck_require__(8387); +// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). +var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; +// Remove all non-word characters. +var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; +/** + * Normalize the string into something other libraries can manipulate easier. + */ +function noCase(input, options) { + if (options === void 0) { options = {}; } + var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lower_case_1.lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; + var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); + var start = 0; + var end = result.length; + // Trim the delimiter from around the output string. + while (result.charAt(start) === "\0") + start++; + while (result.charAt(end - 1) === "\0") + end--; + // Transform each token independently. + return result.slice(start, end).split("\0").map(transform).join(delimiter); +} +exports.noCase = noCase; +/** + * Replace `re` in the input string with the replacement value. + */ +function replace(input, re, value) { + if (re instanceof RegExp) + return input.replace(re, value); + return re.reduce(function (input, re) { return input.replace(re, value); }, input); +} +//# sourceMappingURL=index.js.map + /***/ }), /***/ 467: @@ -14610,6 +14842,73 @@ module.exports = PCancelable; module.exports.CancelError = CancelError; +/***/ }), + +/***/ 8452: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.paramCase = void 0; +var tslib_1 = __nccwpck_require__(9679); +var dot_case_1 = __nccwpck_require__(2246); +function paramCase(input, options) { + if (options === void 0) { options = {}; } + return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: "-" }, options)); +} +exports.paramCase = paramCase; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 5995: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pascalCase = exports.pascalCaseTransformMerge = exports.pascalCaseTransform = void 0; +var tslib_1 = __nccwpck_require__(9679); +var no_case_1 = __nccwpck_require__(6613); +function pascalCaseTransform(input, index) { + var firstChar = input.charAt(0); + var lowerChars = input.substr(1).toLowerCase(); + if (index > 0 && firstChar >= "0" && firstChar <= "9") { + return "_" + firstChar + lowerChars; + } + return "" + firstChar.toUpperCase() + lowerChars; +} +exports.pascalCaseTransform = pascalCaseTransform; +function pascalCaseTransformMerge(input) { + return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); +} +exports.pascalCaseTransformMerge = pascalCaseTransformMerge; +function pascalCase(input, options) { + if (options === void 0) { options = {}; } + return no_case_1.noCase(input, tslib_1.__assign({ delimiter: "", transform: pascalCaseTransform }, options)); +} +exports.pascalCase = pascalCase; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 3553: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pathCase = void 0; +var tslib_1 = __nccwpck_require__(9679); +var dot_case_1 = __nccwpck_require__(2246); +function pathCase(input, options) { + if (options === void 0) { options = {}; } + return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: "/" }, options)); +} +exports.pathCase = pathCase; +//# sourceMappingURL=index.js.map + /***/ }), /***/ 8341: @@ -14792,6 +15091,374 @@ class Response extends Readable { module.exports = Response; +/***/ }), + +/***/ 9229: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sentenceCase = exports.sentenceCaseTransform = void 0; +var tslib_1 = __nccwpck_require__(9679); +var no_case_1 = __nccwpck_require__(6613); +var upper_case_first_1 = __nccwpck_require__(6256); +function sentenceCaseTransform(input, index) { + var result = input.toLowerCase(); + if (index === 0) + return upper_case_first_1.upperCaseFirst(result); + return result; +} +exports.sentenceCaseTransform = sentenceCaseTransform; +function sentenceCase(input, options) { + if (options === void 0) { options = {}; } + return no_case_1.noCase(input, tslib_1.__assign({ delimiter: " ", transform: sentenceCaseTransform }, options)); +} +exports.sentenceCase = sentenceCase; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 6213: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.snakeCase = void 0; +var tslib_1 = __nccwpck_require__(9679); +var dot_case_1 = __nccwpck_require__(2246); +function snakeCase(input, options) { + if (options === void 0) { options = {}; } + return dot_case_1.dotCase(input, tslib_1.__assign({ delimiter: "_" }, options)); +} +exports.snakeCase = snakeCase; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 9679: +/***/ ((module) => { + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + 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; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + 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; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); +}); + + /***/ }), /***/ 4294: @@ -15098,6 +15765,80 @@ exports.getUserAgent = getUserAgent; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 6256: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.upperCaseFirst = void 0; +/** + * Upper case the first character of an input string. + */ +function upperCaseFirst(input) { + return input.charAt(0).toUpperCase() + input.substr(1); +} +exports.upperCaseFirst = upperCaseFirst; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 5997: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.upperCase = exports.localeUpperCase = void 0; +/** + * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt + */ +var SUPPORTED_LOCALE = { + tr: { + regexp: /[\u0069]/g, + map: { + i: "\u0130", + }, + }, + az: { + regexp: /[\u0069]/g, + map: { + i: "\u0130", + }, + }, + lt: { + regexp: /[\u0069\u006A\u012F]\u0307|\u0069\u0307[\u0300\u0301\u0303]/g, + map: { + i̇: "\u0049", + j̇: "\u004A", + į̇: "\u012E", + i̇̀: "\u00CC", + i̇́: "\u00CD", + i̇̃: "\u0128", + }, + }, +}; +/** + * Localized upper case. + */ +function localeUpperCase(str, locale) { + var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; + if (lang) + return upperCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); + return upperCase(str); +} +exports.localeUpperCase = localeUpperCase; +/** + * Upper case as a function. + */ +function upperCase(str) { + return str.toUpperCase(); +} +exports.upperCase = upperCase; +//# sourceMappingURL=index.js.map + /***/ }), /***/ 2940: @@ -15314,7 +16055,9 @@ const { } = __nccwpck_require__(4570) const init = () => { - const client = github.getOctokit(GITHUB_TOKEN, { previews: [ 'flash', 'ant-man' ] }) + const client = github.getOctokit(GITHUB_TOKEN, { + previews: [ 'flash', 'ant-man' ] + }) let deploymentId @@ -15359,7 +16102,9 @@ const init = () => { if (data.length < 1) return - const comment = data.find((comment) => comment.body.includes('This pull request has been deployed to Vercel.')) + const comment = data.find((comment) => + comment.body.includes('This pull request has been deployed to Vercel.') + ) if (comment) { await client.issues.deleteComment({ owner: USER, @@ -15791,6 +16536,7 @@ const core = __nccwpck_require__(2186) const Github = __nccwpck_require__(8396) const Vercel = __nccwpck_require__(847) const { addSchema } = __nccwpck_require__(8505) +const { paramCase } = __nccwpck_require__(9091) const { GITHUB_DEPLOYMENT, @@ -15857,10 +16603,9 @@ const run = async () => { if (IS_PR && PR_PREVIEW_DOMAIN) { core.info(`Assigning custom preview domain to PR`) - const alias = PR_PREVIEW_DOMAIN - .replace('{USER}', USER) - .replace('{REPO}', REPOSITORY) - .replace('{BRANCH}', BRANCH) + const alias = PR_PREVIEW_DOMAIN.replace('{USER}', USER) + .replace('{REPO}', paramCase(REPOSITORY)) + .replace('{BRANCH}', paramCase(BRANCH)) .replace('{PR}', PR_NUMBER) .replace('{SHA}', SHA.substring(0, 7)) .toLowerCase() @@ -15876,8 +16621,8 @@ const run = async () => { for (let i = 0; i < ALIAS_DOMAINS.length; i++) { const alias = ALIAS_DOMAINS[i] .replace('{USER}', USER) - .replace('{REPO}', REPOSITORY) - .replace('{BRANCH}', BRANCH) + .replace('{REPO}', paramCase(REPOSITORY)) + .replace('{BRANCH}', paramCase(BRANCH)) .replace('{SHA}', SHA.substring(0, 7)) .toLowerCase() diff --git a/package-lock.json b/package-lock.json index 41762d64..4b953071 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^4.0.0", "action-input-parser": "^1.2.34", + "change-case": "^4.1.2", "dotenv": "^9.0.2", "got": "^11.8.3", "vercel": "^22.0.1" @@ -1204,6 +1205,15 @@ "node": ">=6" } }, + "node_modules/camel-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "dependencies": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -1229,6 +1239,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/capital-case": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", + "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case-first": "^2.0.2" + } + }, "node_modules/cardinal": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", @@ -1256,6 +1276,25 @@ "node": ">=4" } }, + "node_modules/change-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", + "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", + "dependencies": { + "camel-case": "^4.1.2", + "capital-case": "^1.0.4", + "constant-case": "^3.0.4", + "dot-case": "^3.0.4", + "header-case": "^2.0.4", + "no-case": "^3.0.4", + "param-case": "^3.0.4", + "pascal-case": "^3.1.2", + "path-case": "^3.0.4", + "sentence-case": "^3.0.4", + "snake-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -1368,6 +1407,16 @@ "node": ">=8" } }, + "node_modules/constant-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", + "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case": "^2.0.2" + } + }, "node_modules/conventional-changelog-angular": { "version": "5.0.12", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.12.tgz", @@ -1679,6 +1728,15 @@ "node": ">=6.0.0" } }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -2724,6 +2782,15 @@ "node": ">=8" } }, + "node_modules/header-case": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", + "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", + "dependencies": { + "capital-case": "^1.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/hook-std": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-2.0.0.tgz", @@ -3382,6 +3449,14 @@ "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=", "dev": true }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dependencies": { + "tslib": "^2.0.3" + } + }, "node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -3734,6 +3809,15 @@ "integrity": "sha1-5tq3/r9a2Bbqgc9cYpxaDr3nLBo=", "dev": true }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, "node_modules/node-emoji": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", @@ -7006,6 +7090,15 @@ "semver": "bin/semver.js" } }, + "node_modules/param-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -7060,6 +7153,24 @@ "protocols": "^1.4.0" } }, + "node_modules/pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/path-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", + "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -7736,6 +7847,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/sentence-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", + "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case-first": "^2.0.2" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -7861,6 +7982,15 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/snake-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", + "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -8306,6 +8436,11 @@ "typescript": ">=2.7" } }, + "node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", @@ -8480,6 +8615,22 @@ "node": ">=8" } }, + "node_modules/upper-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", + "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/upper-case-first": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", + "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", + "dependencies": { + "tslib": "^2.0.3" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -9734,6 +9885,15 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, + "camel-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "requires": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -9750,6 +9910,16 @@ "quick-lru": "^4.0.1" } }, + "capital-case": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", + "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case-first": "^2.0.2" + } + }, "cardinal": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", @@ -9771,6 +9941,25 @@ "supports-color": "^5.3.0" } }, + "change-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", + "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", + "requires": { + "camel-case": "^4.1.2", + "capital-case": "^1.0.4", + "constant-case": "^3.0.4", + "dot-case": "^3.0.4", + "header-case": "^2.0.4", + "no-case": "^3.0.4", + "param-case": "^3.0.4", + "pascal-case": "^3.1.2", + "path-case": "^3.0.4", + "sentence-case": "^3.0.4", + "snake-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -9865,6 +10054,16 @@ "xdg-basedir": "^4.0.0" } }, + "constant-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", + "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case": "^2.0.2" + } + }, "conventional-changelog-angular": { "version": "5.0.12", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.12.tgz", @@ -10092,6 +10291,15 @@ "esutils": "^2.0.2" } }, + "dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -10915,6 +11123,15 @@ "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==" }, + "header-case": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", + "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", + "requires": { + "capital-case": "^1.0.4", + "tslib": "^2.0.3" + } + }, "hook-std": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-2.0.0.tgz", @@ -11436,6 +11653,14 @@ "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=", "dev": true }, + "lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "requires": { + "tslib": "^2.0.3" + } + }, "lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -11695,6 +11920,15 @@ "integrity": "sha1-5tq3/r9a2Bbqgc9cYpxaDr3nLBo=", "dev": true }, + "no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "requires": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, "node-emoji": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", @@ -14071,6 +14305,15 @@ } } }, + "param-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "requires": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -14116,6 +14359,24 @@ "protocols": "^1.4.0" } }, + "pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "path-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", + "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", + "requires": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -14590,6 +14851,16 @@ "integrity": "sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==", "dev": true }, + "sentence-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", + "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3", + "upper-case-first": "^2.0.2" + } + }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -14686,6 +14957,15 @@ } } }, + "snake-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", + "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "requires": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -15042,6 +15322,11 @@ "yn": "3.1.1" } }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", @@ -15166,6 +15451,22 @@ } } }, + "upper-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", + "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", + "requires": { + "tslib": "^2.0.3" + } + }, + "upper-case-first": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", + "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", + "requires": { + "tslib": "^2.0.3" + } + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 5f1f1593..8807f342 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^4.0.0", "action-input-parser": "^1.2.34", + "change-case": "^4.1.2", "dotenv": "^9.0.2", "got": "^11.8.3", "vercel": "^22.0.1" diff --git a/src/github.js b/src/github.js index 0ff69d93..f95b9f40 100644 --- a/src/github.js +++ b/src/github.js @@ -13,7 +13,9 @@ const { } = require('./config') const init = () => { - const client = github.getOctokit(GITHUB_TOKEN, { previews: [ 'flash', 'ant-man' ] }) + const client = github.getOctokit(GITHUB_TOKEN, { + previews: [ 'flash', 'ant-man' ] + }) let deploymentId @@ -58,7 +60,9 @@ const init = () => { if (data.length < 1) return - const comment = data.find((comment) => comment.body.includes('This pull request has been deployed to Vercel.')) + const comment = data.find((comment) => + comment.body.includes('This pull request has been deployed to Vercel.') + ) if (comment) { await client.issues.deleteComment({ owner: USER, diff --git a/src/index.js b/src/index.js index c290e5c0..cb262a77 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,7 @@ const core = require('@actions/core') const Github = require('./github') const Vercel = require('./vercel') const { addSchema } = require('./helpers') +const { paramCase } = require('change-case') const { GITHUB_DEPLOYMENT, @@ -68,10 +69,9 @@ const run = async () => { if (IS_PR && PR_PREVIEW_DOMAIN) { core.info(`Assigning custom preview domain to PR`) - const alias = PR_PREVIEW_DOMAIN - .replace('{USER}', USER) - .replace('{REPO}', REPOSITORY) - .replace('{BRANCH}', BRANCH) + const alias = PR_PREVIEW_DOMAIN.replace('{USER}', USER) + .replace('{REPO}', paramCase(REPOSITORY)) + .replace('{BRANCH}', paramCase(BRANCH)) .replace('{PR}', PR_NUMBER) .replace('{SHA}', SHA.substring(0, 7)) .toLowerCase() @@ -87,8 +87,8 @@ const run = async () => { for (let i = 0; i < ALIAS_DOMAINS.length; i++) { const alias = ALIAS_DOMAINS[i] .replace('{USER}', USER) - .replace('{REPO}', REPOSITORY) - .replace('{BRANCH}', BRANCH) + .replace('{REPO}', paramCase(REPOSITORY)) + .replace('{BRANCH}', paramCase(BRANCH)) .replace('{SHA}', SHA.substring(0, 7)) .toLowerCase() From eb7c7dbbfc8c277ebedd9e351968c4004415717b Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Wed, 15 Jun 2022 18:26:15 +1200 Subject: [PATCH 02/17] chore: linting --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 3d50a727..43a3ad8c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1 +1 @@ -module.exports = require('@betahuhn/config').eslint +module.exports = require('@betahuhn/config').eslint \ No newline at end of file From 43a13c9074294914ab9e72547af37e24b6268a31 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Wed, 15 Jun 2022 18:27:29 +1200 Subject: [PATCH 03/17] fix: param case user --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index cb262a77..3d7c3abf 100644 --- a/src/index.js +++ b/src/index.js @@ -69,7 +69,7 @@ const run = async () => { if (IS_PR && PR_PREVIEW_DOMAIN) { core.info(`Assigning custom preview domain to PR`) - const alias = PR_PREVIEW_DOMAIN.replace('{USER}', USER) + const alias = PR_PREVIEW_DOMAIN.replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) .replace('{PR}', PR_NUMBER) @@ -86,7 +86,7 @@ const run = async () => { for (let i = 0; i < ALIAS_DOMAINS.length; i++) { const alias = ALIAS_DOMAINS[i] - .replace('{USER}', USER) + .replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) .replace('{SHA}', SHA.substring(0, 7)) From f5cdb9d6009278d21c251491478df9e7fb2a7b81 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Wed, 15 Jun 2022 18:31:18 +1200 Subject: [PATCH 04/17] chore: comment --- .prettierignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.prettierignore b/.prettierignore index b75736bc..70d4537b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ +# Don't run prettier on this repo, as it uses eslint instead + src dist .github From a81916ef2855e4d2cd8240423940d997247c2fe9 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Wed, 15 Jun 2022 18:31:43 +1200 Subject: [PATCH 05/17] chore: comment --- .editorconfig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index 450e4146..a8a3d615 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,8 +1,3 @@ -# See https://prettier.io/docs/en/configuration.html#editorconfig - -# Stop the editor from looking for .editorconfig files in the parent directories -root = true - [*] charset = utf-8 insert_final_newline = false From c1dbb0b614a57818c203cb8f33a95258d4fbb3a3 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Wed, 15 Jun 2022 18:32:56 +1200 Subject: [PATCH 06/17] chore: formatting --- src/github.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/github.js b/src/github.js index f95b9f40..0ff69d93 100644 --- a/src/github.js +++ b/src/github.js @@ -13,9 +13,7 @@ const { } = require('./config') const init = () => { - const client = github.getOctokit(GITHUB_TOKEN, { - previews: [ 'flash', 'ant-man' ] - }) + const client = github.getOctokit(GITHUB_TOKEN, { previews: [ 'flash', 'ant-man' ] }) let deploymentId @@ -60,9 +58,7 @@ const init = () => { if (data.length < 1) return - const comment = data.find((comment) => - comment.body.includes('This pull request has been deployed to Vercel.') - ) + const comment = data.find((comment) => comment.body.includes('This pull request has been deployed to Vercel.')) if (comment) { await client.issues.deleteComment({ owner: USER, From 6ec85dfe1d5cb29a60302fcdb0f5bddae0329767 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Thu, 16 Jun 2022 09:42:19 +1200 Subject: [PATCH 07/17] feat: output unique deployment url --- action.yml | 2 ++ dist/index.js | 13 +++++-------- src/index.js | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index b23e56f6..be0e3af3 100644 --- a/action.yml +++ b/action.yml @@ -87,6 +87,8 @@ outputs: description: 'True if a comment was created on the PR or commit.' DEPLOYMENT_INSPECTOR_URL: description: 'Main deployment inspection url.' + DEPLOYMENT_UNIQUE_URL: + description: "The unique deployment url on Vercel" runs: using: 'node12' diff --git a/dist/index.js b/dist/index.js index 9401a3ed..fdc5d124 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16055,9 +16055,7 @@ const { } = __nccwpck_require__(4570) const init = () => { - const client = github.getOctokit(GITHUB_TOKEN, { - previews: [ 'flash', 'ant-man' ] - }) + const client = github.getOctokit(GITHUB_TOKEN, { previews: [ 'flash', 'ant-man' ] }) let deploymentId @@ -16102,9 +16100,7 @@ const init = () => { if (data.length < 1) return - const comment = data.find((comment) => - comment.body.includes('This pull request has been deployed to Vercel.') - ) + const comment = data.find((comment) => comment.body.includes('This pull request has been deployed to Vercel.')) if (comment) { await client.issues.deleteComment({ owner: USER, @@ -16603,7 +16599,7 @@ const run = async () => { if (IS_PR && PR_PREVIEW_DOMAIN) { core.info(`Assigning custom preview domain to PR`) - const alias = PR_PREVIEW_DOMAIN.replace('{USER}', USER) + const alias = PR_PREVIEW_DOMAIN.replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) .replace('{PR}', PR_NUMBER) @@ -16620,7 +16616,7 @@ const run = async () => { for (let i = 0; i < ALIAS_DOMAINS.length; i++) { const alias = ALIAS_DOMAINS[i] - .replace('{USER}', USER) + .replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) .replace('{SHA}', SHA.substring(0, 7)) @@ -16688,6 +16684,7 @@ const run = async () => { core.setOutput('PREVIEW_URL', previewUrl) core.setOutput('DEPLOYMENT_URLS', deploymentUrls) + core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentUrl) core.setOutput('DEPLOYMENT_ID', deployment.id) core.setOutput('DEPLOYMENT_INSPECTOR_URL', deployment.inspectorUrl) core.setOutput('DEPLOYMENT_CREATED', true) diff --git a/src/index.js b/src/index.js index 3d7c3abf..0d46b11c 100644 --- a/src/index.js +++ b/src/index.js @@ -154,6 +154,7 @@ const run = async () => { core.setOutput('PREVIEW_URL', previewUrl) core.setOutput('DEPLOYMENT_URLS', deploymentUrls) + core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentUrl) core.setOutput('DEPLOYMENT_ID', deployment.id) core.setOutput('DEPLOYMENT_INSPECTOR_URL', deployment.inspectorUrl) core.setOutput('DEPLOYMENT_CREATED', true) From 42401b784c324def67b06706cde33735652ac7ce Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Thu, 16 Jun 2022 09:53:08 +1200 Subject: [PATCH 08/17] fix: get deployment url with protocol --- dist/index.js | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index fdc5d124..e975fcd6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16684,7 +16684,7 @@ const run = async () => { core.setOutput('PREVIEW_URL', previewUrl) core.setOutput('DEPLOYMENT_URLS', deploymentUrls) - core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentUrl) + core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentUrls[deploymentUrls.length - 1]) core.setOutput('DEPLOYMENT_ID', deployment.id) core.setOutput('DEPLOYMENT_INSPECTOR_URL', deployment.inspectorUrl) core.setOutput('DEPLOYMENT_CREATED', true) diff --git a/src/index.js b/src/index.js index 0d46b11c..aef23248 100644 --- a/src/index.js +++ b/src/index.js @@ -154,7 +154,7 @@ const run = async () => { core.setOutput('PREVIEW_URL', previewUrl) core.setOutput('DEPLOYMENT_URLS', deploymentUrls) - core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentUrl) + core.setOutput('DEPLOYMENT_UNIQUE_URL', deploymentUrls[deploymentUrls.length - 1]) core.setOutput('DEPLOYMENT_ID', deployment.id) core.setOutput('DEPLOYMENT_INSPECTOR_URL', deployment.inspectorUrl) core.setOutput('DEPLOYMENT_CREATED', true) From 83270fcc32000099cd92a9be671ae78f64e594ee Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 16:25:33 +1200 Subject: [PATCH 09/17] feat: handle long branch urls --- src/index.js | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index aef23248..eafdbb12 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,11 @@ +// @ts-check const core = require('@actions/core') const Github = require('./github') const Vercel = require('./vercel') const { addSchema } = require('./helpers') const { paramCase } = require('change-case') +const crypto = require('crypto') + const { GITHUB_DEPLOYMENT, @@ -69,6 +72,10 @@ const run = async () => { if (IS_PR && PR_PREVIEW_DOMAIN) { core.info(`Assigning custom preview domain to PR`) + if (typeof PR_PREVIEW_DOMAIN !== 'string') { + throw new Error(`invalid type for PR_PREVIEW_DOMAIN`) + } + const alias = PR_PREVIEW_DOMAIN.replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) @@ -76,16 +83,38 @@ const run = async () => { .replace('{SHA}', SHA.substring(0, 7)) .toLowerCase() - await vercel.assignAlias(alias) + const previewDomainSuffix = '.vercel.app' + let nextAlias = alias + + // https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls + if (alias.endsWith(previewDomainSuffix)) { + let prefix = alias.substring(0, alias.indexOf(previewDomainSuffix)) + + if (prefix.length >= 63) { + prefix = prefix.substring(0, 56) - deploymentUrls.push(addSchema(alias)) + const uniqueSuffix = crypto.createHash('sha256') + .update(`git-${ BRANCH }-${ REPOSITORY }`) + .digest('base64') + .slice(0, 6) + + nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` + } + } + + await vercel.assignAlias(nextAlias) + deploymentUrls.push(addSchema(nextAlias)) } if (!IS_PR && ALIAS_DOMAINS) { core.info(`Assigning custom domains to Vercel deployment`) + if (!Array.isArray(ALIAS_DOMAINS)) { + throw new Error(`invalid type for PR_PREVIEW_DOMAIN`) + } + for (let i = 0; i < ALIAS_DOMAINS.length; i++) { - const alias = ALIAS_DOMAINS[i] + const alias = /** @type {string} */ (ALIAS_DOMAINS[i]) .replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) From e164c6c72c952900e2346e033bc5a838574ef166 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 16:33:18 +1200 Subject: [PATCH 10/17] feat: add logging --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index eafdbb12..d41cecbb 100644 --- a/src/index.js +++ b/src/index.js @@ -86,19 +86,19 @@ const run = async () => { const previewDomainSuffix = '.vercel.app' let nextAlias = alias - // https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls if (alias.endsWith(previewDomainSuffix)) { let prefix = alias.substring(0, alias.indexOf(previewDomainSuffix)) - if (prefix.length >= 63) { + if (prefix.length >= 60) { + core.info(`${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) prefix = prefix.substring(0, 56) - const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) .digest('base64') .slice(0, 6) nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` + core.info(`new domain alias: ${ nextAlias }`) } } From 006938511dceaeb391cbb3fa28d812a38773cbb7 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 16:39:47 +1200 Subject: [PATCH 11/17] chore: debug --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index d41cecbb..754fa2af 100644 --- a/src/index.js +++ b/src/index.js @@ -86,8 +86,11 @@ const run = async () => { const previewDomainSuffix = '.vercel.app' let nextAlias = alias + core.info(`debug nextAlias ${ nextAlias }`) + if (alias.endsWith(previewDomainSuffix)) { let prefix = alias.substring(0, alias.indexOf(previewDomainSuffix)) + core.info(`debug prefix ${ prefix }`) if (prefix.length >= 60) { core.info(`${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) From 4ddaddc5ac2437f0963490401f38725fc4941986 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 16:48:19 +1200 Subject: [PATCH 12/17] feat: logs --- dist/index.js | 44 +++++++++++++++++++++++++++++++++++++++++--- src/index.js | 6 ++---- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/dist/index.js b/dist/index.js index e975fcd6..e1feb200 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16375,6 +16375,14 @@ module.exports = require("child_process"); /***/ }), +/***/ 6113: +/***/ ((module) => { + +"use strict"; +module.exports = require("crypto"); + +/***/ }), + /***/ 9523: /***/ ((module) => { @@ -16528,11 +16536,14 @@ module.exports = require("zlib"); var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { +// @ts-check const core = __nccwpck_require__(2186) const Github = __nccwpck_require__(8396) const Vercel = __nccwpck_require__(847) const { addSchema } = __nccwpck_require__(8505) const { paramCase } = __nccwpck_require__(9091) +const crypto = __nccwpck_require__(6113) + const { GITHUB_DEPLOYMENT, @@ -16599,6 +16610,10 @@ const run = async () => { if (IS_PR && PR_PREVIEW_DOMAIN) { core.info(`Assigning custom preview domain to PR`) + if (typeof PR_PREVIEW_DOMAIN !== 'string') { + throw new Error(`invalid type for PR_PREVIEW_DOMAIN`) + } + const alias = PR_PREVIEW_DOMAIN.replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) @@ -16606,16 +16621,39 @@ const run = async () => { .replace('{SHA}', SHA.substring(0, 7)) .toLowerCase() - await vercel.assignAlias(alias) + const previewDomainSuffix = '.vercel.app' + let nextAlias = alias - deploymentUrls.push(addSchema(alias)) + + if (alias.endsWith(previewDomainSuffix)) { + let prefix = alias.substring(0, alias.indexOf(previewDomainSuffix)) + + if (prefix.length >= 60) { + core.info(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) + prefix = prefix.substring(0, 56) + const uniqueSuffix = crypto.createHash('sha256') + .update(`git-${ BRANCH }-${ REPOSITORY }`) + .digest('base64') + .slice(0, 6) + + nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` + core.info(`Updated domain alias: ${ nextAlias }`) + } + } + + await vercel.assignAlias(nextAlias) + deploymentUrls.push(addSchema(nextAlias)) } if (!IS_PR && ALIAS_DOMAINS) { core.info(`Assigning custom domains to Vercel deployment`) + if (!Array.isArray(ALIAS_DOMAINS)) { + throw new Error(`invalid type for PR_PREVIEW_DOMAIN`) + } + for (let i = 0; i < ALIAS_DOMAINS.length; i++) { - const alias = ALIAS_DOMAINS[i] + const alias = /** @type {string} */ (ALIAS_DOMAINS[i]) .replace('{USER}', paramCase(USER)) .replace('{REPO}', paramCase(REPOSITORY)) .replace('{BRANCH}', paramCase(BRANCH)) diff --git a/src/index.js b/src/index.js index 754fa2af..844eb69e 100644 --- a/src/index.js +++ b/src/index.js @@ -86,14 +86,12 @@ const run = async () => { const previewDomainSuffix = '.vercel.app' let nextAlias = alias - core.info(`debug nextAlias ${ nextAlias }`) if (alias.endsWith(previewDomainSuffix)) { let prefix = alias.substring(0, alias.indexOf(previewDomainSuffix)) - core.info(`debug prefix ${ prefix }`) if (prefix.length >= 60) { - core.info(`${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) + core.info(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) prefix = prefix.substring(0, 56) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) @@ -101,7 +99,7 @@ const run = async () => { .slice(0, 6) nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` - core.info(`new domain alias: ${ nextAlias }`) + core.info(`Updated domain alias: ${ nextAlias }`) } } From 5abbe4c890ef96480c57b83bde480f2fa30099ef Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 16:53:33 +1200 Subject: [PATCH 13/17] fix: must be 63 chars --- dist/index.js | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index e1feb200..46aaf7b9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16630,7 +16630,7 @@ const run = async () => { if (prefix.length >= 60) { core.info(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) - prefix = prefix.substring(0, 56) + prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) .digest('base64') diff --git a/src/index.js b/src/index.js index 844eb69e..b511110e 100644 --- a/src/index.js +++ b/src/index.js @@ -92,7 +92,7 @@ const run = async () => { if (prefix.length >= 60) { core.info(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) - prefix = prefix.substring(0, 56) + prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) .digest('base64') From 5075bf5ec68dd8fd0d5e11d4ebf9fac71c5ed53c Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 17:00:10 +1200 Subject: [PATCH 14/17] fix: b64url --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b511110e..899cccba 100644 --- a/src/index.js +++ b/src/index.js @@ -95,7 +95,7 @@ const run = async () => { prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) - .digest('base64') + .digest('base64url') .slice(0, 6) nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` From 32b89c15c8be3a5b3fedf70e6d208a650f5c03fc Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 17:00:20 +1200 Subject: [PATCH 15/17] fix: b64url --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 46aaf7b9..2a983ef6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16633,7 +16633,7 @@ const run = async () => { prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) - .digest('base64') + .digest('base64url') .slice(0, 6) nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` From 61ffeb35812e4c08d36e94a3ee7e7a304b883d95 Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 17:09:10 +1200 Subject: [PATCH 16/17] fix: digest to hex --- dist/index.js | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2a983ef6..417af909 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16633,7 +16633,7 @@ const run = async () => { prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) - .digest('base64url') + .digest('hex') .slice(0, 6) nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` diff --git a/src/index.js b/src/index.js index 899cccba..86811872 100644 --- a/src/index.js +++ b/src/index.js @@ -95,7 +95,7 @@ const run = async () => { prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) - .digest('base64url') + .digest('hex') .slice(0, 6) nextAlias = `${ prefix }-${ uniqueSuffix }${ previewDomainSuffix }` From db5c7f85c4de5a8acb41fd9e1b9edcbbbdd1526c Mon Sep 17 00:00:00 2001 From: Josh Barr Date: Fri, 17 Jun 2022 17:13:48 +1200 Subject: [PATCH 17/17] chore: info to warning --- dist/index.js | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 417af909..59b604a6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16629,7 +16629,7 @@ const run = async () => { let prefix = alias.substring(0, alias.indexOf(previewDomainSuffix)) if (prefix.length >= 60) { - core.info(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) + core.warning(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. See https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`) diff --git a/src/index.js b/src/index.js index 86811872..ed0df2ed 100644 --- a/src/index.js +++ b/src/index.js @@ -91,7 +91,7 @@ const run = async () => { let prefix = alias.substring(0, alias.indexOf(previewDomainSuffix)) if (prefix.length >= 60) { - core.info(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. \n\nSee https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) + core.warning(`The alias ${ prefix } exceeds 60 chars in length, truncating using vercel's rules. See https://vercel.com/docs/concepts/deployments/automatic-urls#automatic-branch-urls`) prefix = prefix.substring(0, 55) const uniqueSuffix = crypto.createHash('sha256') .update(`git-${ BRANCH }-${ REPOSITORY }`)