diff --git a/dist/index.js b/dist/index.js index 4be998b..c1e98fc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4727,6 +4727,1533 @@ module.exports = { } +/***/ }), + +/***/ 32997: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BranchFileCache = exports.RepositoryFileCache = exports.FileNotFoundError = exports.DEFAULT_FILE_MODE = void 0; +const path_1 = __nccwpck_require__(85622); +const minimatch_1 = __nccwpck_require__(28162); +exports.DEFAULT_FILE_MODE = '100644'; +class FileNotFoundError extends Error { + constructor(path) { + super(`Failed to find file: ${path}`); + this.path = path; + this.name = FileNotFoundError.name; + } +} +exports.FileNotFoundError = FileNotFoundError; +/** + * This class is a read-through cache aimed at minimizing the + * number of API requests needed to fetch file data/contents. + * It lazy-caches data as it reads and will return cached data + * for resources already fetched. + */ +class RepositoryFileCache { + /** + * Instantiate a new loading cache instance + * + * @param {Octokit} octokit An authenticated octokit instance + * @param {Repository} repository The repository we are fetching data for + */ + constructor(octokit, repository) { + this.octokit = octokit; + this.repository = repository; + this.cache = new Map(); + } + /** + * Fetch file contents for given path on a given branch. If the + * data has already been fetched, return a cached copy. + * + * @param {string} path Path to the file + * @param {string} branch Branch to fetch the file from + * @returns {GitHubFileContents} The file contents + */ + async getFileContents(path, branch) { + const fileCache = this.getBranchFileCache(branch); + return await fileCache.getFileContents(path); + } + /** + * Find all files with a given filename. + * + * @param {string} filename The filename of the files to search for. + * @param {string} branch The name of the branch to search on. + * @param {string} pathPrefix If set, limit results to files that begin + * with this path prefix. Also if set, returns the path relative to + * the path prefix. + * @returns {string[]} Paths to the files (relative to path prefix) + */ + async findFilesByFilename(filename, branch, pathPrefix) { + const fileCache = this.getBranchFileCache(branch); + return await fileCache.findFilesByFilename(filename, pathPrefix); + } + /** + * Find all files with a given file extension. + * + * @param {string} filename The file extension (excluding `.`) of the + * files to search for. Example: `yaml`. + * @param {string} branch The name of the branch to search on. + * @param {string} pathPrefix If set, limit results to files that begin + * with this path prefix. Also if set, returns the path relative to + * the path prefix. + * @returns {string[]} Paths to the files (relative to path prefix) + */ + async findFilesByExtension(extension, branch, pathPrefix) { + const fileCache = this.getBranchFileCache(branch); + return await fileCache.findFilesByExtension(extension, pathPrefix); + } + /** + * Find all files matching a given glob. + * + * @param {string} glob The glob to match. + * @param {string} branch The name of the branch to search on. + * @param {string} pathPrefix If set, limit results to files that begin + * with this path prefix. Also if set, returns the path relative to + * the path prefix. + * @returns {string[]} Paths to the files (relative to path prefix) + */ + async findFilesByGlob(glob, branch, pathPrefix) { + const fileCache = this.getBranchFileCache(branch); + return await fileCache.findFilesByGlob(glob, pathPrefix); + } + /** + * Helper to find or create a BranchFileCache + * @param {string} branch The branch the cache is for + * @returns {BranchFileCache} The branch file cache + */ + getBranchFileCache(branch) { + let fileCache = this.cache.get(branch); + if (!fileCache) { + fileCache = new BranchFileCache(this.octokit, this.repository, branch); + this.cache.set(branch, fileCache); + } + return fileCache; + } +} +exports.RepositoryFileCache = RepositoryFileCache; +/** + * This class is a read-through cache for a single branch aimed + * at minimizing the number of API requests needed to fetch file + * data/contents. It lazy-caches data as it reads and will return + * cached data for resources already fetched. + */ +class BranchFileCache { + /** + * Instantiate a new loading cache instance + * + * @param {Octokit} octokit An authenticated octokit instance + * @param {Repository} repository The repository we are fetching data for + * @param {string} branch The branch we are fetching data from + */ + constructor(octokit, repository, branch) { + this.octokit = octokit; + this.repository = repository; + this.branch = branch; + this.cache = new Map(); + this.treeCache = new Map(); + } + /** + * Fetch file contents for given path. If the data has already been + * fetched, return the cached copy. + * + * @param {string} path Path to the file + * @param {string} branch Branch to fetch the file from + * @returns {GitHubFileContents} The file contents + */ + async getFileContents(path) { + const cached = this.cache.get(path); + if (cached) { + return cached; + } + const fetched = await this.fetchFileContents(path); + this.cache.set(path, fetched); + return fetched; + } + /** + * Find all files with a given filename. + * + * @param {string} filename The filename of the files to search for. + * @param {string} pathPrefix If set, limit results to files that begin + * with this path prefix. Also if set, returns the path relative to + * the path prefix. + * @returns {string[]} Paths to the files (relative to path prefix) + */ + async findFilesByFilename(filename, pathPrefix) { + const files = []; + for await (const treeEntry of this.treeEntryIterator(this.branch, pathPrefix)) { + if ((0, path_1.basename)(treeEntry.path) === filename) { + files.push(treeEntry.path); + } + } + return stripPrefix(files, pathPrefix); + } + /** + * Find all files with a given file extension. + * + * @param {string} filename The file extension (excluding `.`) of the + * files to search for. Example: `yaml`. + * @param {string} pathPrefix If set, limit results to files that begin + * with this path prefix. Also if set, returns the path relative to + * the path prefix. + * @returns {string[]} Paths to the files (relative to path prefix) + */ + async findFilesByExtension(extension, pathPrefix) { + const files = []; + for await (const treeEntry of this.treeEntryIterator(this.branch, pathPrefix)) { + if ((0, path_1.extname)(treeEntry.path) === `.${extension}`) { + files.push(treeEntry.path); + } + } + return stripPrefix(files, pathPrefix); + } + /** + * Find all files matching a given glob. + * + * @param {string} glob The glob to match. + * @param {string} pathPrefix If set, limit results to files that begin + * with this path prefix. Also if set, returns the path relative to + * the path prefix. + * @returns {string[]} Paths to the files (relative to path prefix) + */ + async findFilesByGlob(glob, pathPrefix) { + const files = []; + const mm = new minimatch_1.Minimatch(glob); + for await (const treeEntry of this.treeEntryIterator(this.branch, pathPrefix)) { + if (mm.match(treeEntry.path)) { + files.push(treeEntry.path); + } + } + return stripPrefix(files, pathPrefix); + } + /** + * Actually fetch the file contents. Uses the tree API to fetch file + * data. + * + * @param {string} path Path to the file + */ + async fetchFileContents(path) { + // try to use the entire git tree if it's not too big + const treeEntries = await this.getFullTree(); + if (treeEntries) { + const found = treeEntries.find(entry => entry.path === path); + if (found === null || found === void 0 ? void 0 : found.sha) { + return await this.fetchContents(found.sha, found); + } + throw new FileNotFoundError(path); + } + // full tree is too big, use data API to fetch + const parts = path.split('/'); + let treeSha = this.branch; + let found; + for (const part of parts) { + const { tree } = await this.getTree(treeSha); + found = tree.find(item => item.path === part); + if (!(found === null || found === void 0 ? void 0 : found.sha)) { + throw new FileNotFoundError(path); + } + treeSha = found.sha; + } + if (found === null || found === void 0 ? void 0 : found.sha) { + return await this.fetchContents(found.sha, found); + } + throw new FileNotFoundError(path); + } + /** + * Return the full recursive git tree. If already fetched, return + * the cached version. If the tree is too big, return null. + * + * @returns {TreeEntry[]} The tree entries + */ + async getFullTree() { + const cachedTree = await this.getTree(this.branch); + if (cachedTree.recursive) { + return cachedTree.tree; + } + return null; + } + /** + * Returns the git tree for a given SHA. If already fetched, return + * the cached version. If possible, return the entire contents of the + * (sub)tree. This will limit the number + * + * @param {string} sha The tree SHA + * @returns {CachedTree} The tree entries and whether the subtree response + * was complete or not (recursive: true means that we have all the files) + */ + async getTree(sha) { + const cached = this.treeCache.get(sha); + if (cached) { + // We've already fetching this tree, return the cached version + return cached; + } + // try the fetch the entire tree first + const fetched = await this.fetchTree(sha, true); + if (fetched.truncated) { + // we are unable to fetch the entire tree, so fetch only contents of + // this single directory + const singleDirectory = await this.fetchTree(sha, false); + if (singleDirectory.truncated) { + // the single directory has too many files, we can't drill down any + // further + console.warn(`non-recursive file list for tree ${sha} is truncated, this folder has too many files!!!`); + } + const cachedTree = { + tree: singleDirectory.tree, + recursive: false, + }; + this.treeCache.set(sha, cachedTree); + return cachedTree; + } + else { + // we are able to fetch all the files in this (sub)tree + const cachedTree = { + tree: fetched.tree, + recursive: true, + }; + this.treeCache.set(sha, cachedTree); + return cachedTree; + } + } + /** + * Fetch the git tree via the GitHub API + * + * @param {string} sha The tree SHA + * @param {boolean} recursive Whether to make a recursive call or not + * @returns {TreeResponse} The tree response + */ + async fetchTree(sha, recursive) { + const { data: { tree, truncated }, } = await this.octokit.git.getTree({ + owner: this.repository.owner, + repo: this.repository.repo, + tree_sha: sha, + // fetching tree non-recursively requires omitting the param + recursive: recursive ? 'true' : undefined, + }); + return { + tree, + truncated, + }; + } + /** + * Async iterator for iterating over all files in the repository. + * + * @param {string} ref The starting git tree reference. Can be a tree SHA or + * a branch reference. + * @param {string} pathPrefix If set, limit results to files that begin + * with this path prefix. + */ + async *treeEntryIterator(ref, pathPrefix) { + const treeShas = [{ ref }]; + let treeReference; + while ((treeReference = treeShas.shift())) { + const cachedTree = await this.getTree(treeReference.ref); + for (const treeEntry of cachedTree.tree) { + // paths are relative to the fetched directory, so normalize the path + const path = treeReference.path + ? `${treeReference.path}/${treeEntry.path}` + : treeEntry.path; + // short-circuit iterator if we're in the wrong directory + if (pathPrefix && + path && + !pathPrefix.startsWith(path) && + !path.startsWith(pathPrefix)) { + continue; + } + // If the result for this SHA was incomplete, dig deeper on the subtrees + if (!cachedTree.recursive && treeEntry.type === 'tree') { + treeShas.push({ ref: treeEntry.sha, path }); + } + yield { + ...treeEntry, + path, + }; + } + } + } + /** + * Fetch the git blob from the GitHub API and convert into a + * GitHubFileContents object. + * + * @param {string} blobSha The git blob SHA + * @param {TreeEntry} treeEntry The associated tree object + */ + async fetchContents(blobSha, treeEntry) { + const { data: { content }, } = await this.octokit.git.getBlob({ + owner: this.repository.owner, + repo: this.repository.repo, + file_sha: blobSha, + }); + return { + sha: blobSha, + mode: treeEntry.mode || exports.DEFAULT_FILE_MODE, + content, + parsedContent: Buffer.from(content, 'base64').toString('utf8'), + }; + } +} +exports.BranchFileCache = BranchFileCache; +function stripPrefix(files, prefix) { + if (!prefix) { + return files; + } + const prefixRegex = new RegExp(`^${prefix}[/\\\\]`); + return files + .filter(file => file.startsWith(`${prefix}/`)) + .map(file => file.replace(prefixRegex, '')); +} +//# sourceMappingURL=git-file-utils.js.map + +/***/ }), + +/***/ 7662: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var balanced = __nccwpck_require__(9417); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m) return [str]; + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + if (/\$$/.test(m.pre)) { + for (var k = 0; k < post.length; k++) { + var expansion = pre+ '{' + m.body + '}' + post[k]; + expansions.push(expansion); + } + } else { + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = []; + + for (var j = 0; j < n.length; j++) { + N.push.apply(N, expand(n[j], false)); + } + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + } + + return expansions; +} + + + +/***/ }), + +/***/ 14938: +/***/ ((module) => { + +const isWindows = typeof process === 'object' && + process && + process.platform === 'win32' +module.exports = isWindows ? { sep: '\\' } : { sep: '/' } + + +/***/ }), + +/***/ 28162: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const minimatch = module.exports = (p, pattern, options = {}) => { + assertValidPattern(pattern) + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +module.exports = minimatch + +const path = __nccwpck_require__(14938) +minimatch.sep = path.sep + +const GLOBSTAR = Symbol('globstar **') +minimatch.GLOBSTAR = GLOBSTAR +const expand = __nccwpck_require__(7662) + +const plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +const qmark = '[^/]' + +// * => any number of characters +const star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// "abc" -> { a:true, b:true, c:true } +const charSet = s => s.split('').reduce((set, c) => { + set[c] = true + return set +}, {}) + +// characters that need to be escaped in RegExp. +const reSpecials = charSet('().*{}+?[]^$\\!') + +// characters that indicate we have to add the pattern start +const addPatternStartSet = charSet('[.(') + +// normalizes slashes. +const slashSplit = /\/+/ + +minimatch.filter = (pattern, options = {}) => + (p, i, list) => minimatch(p, pattern, options) + +const ext = (a, b = {}) => { + const t = {} + Object.keys(a).forEach(k => t[k] = a[k]) + Object.keys(b).forEach(k => t[k] = b[k]) + return t +} + +minimatch.defaults = def => { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + const orig = minimatch + + const m = (p, pattern, options) => orig(p, pattern, ext(def, options)) + m.Minimatch = class Minimatch extends orig.Minimatch { + constructor (pattern, options) { + super(pattern, ext(def, options)) + } + } + m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch + m.filter = (pattern, options) => orig.filter(pattern, ext(def, options)) + m.defaults = options => orig.defaults(ext(def, options)) + m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options)) + m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options)) + m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options)) + + return m +} + + + + + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options) + +const braceExpand = (pattern, options = {}) => { + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +const MAX_PATTERN_LENGTH = 1024 * 64 +const assertValidPattern = pattern => { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +const SUBPARSE = Symbol('subparse') + +minimatch.makeRe = (pattern, options) => + new Minimatch(pattern, options || {}).makeRe() + +minimatch.match = (list, pattern, options = {}) => { + const mm = new Minimatch(pattern, options) + list = list.filter(f => mm.match(f)) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +// replace stuff like \* with * +const globUnescape = s => s.replace(/\\(.)/g, '$1') +const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') + +class Minimatch { + constructor (pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + this.options = options + this.set = [] + this.pattern = pattern + this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || + options.allowWindowsEscape === false + if (this.windowsPathsNoEscape) { + this.pattern = this.pattern.replace(/\\/g, '/') + } + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() + } + + debug () {} + + make () { + const pattern = this.pattern + const options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + let set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = (...args) => console.error(...args) + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(s => s.split(slashSplit)) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map((s, si, set) => s.map(this.parse, this)) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(s => s.indexOf(false) === -1) + + this.debug(this.pattern, set) + + this.set = set + } + + parseNegate () { + if (this.options.nonegate) return + + const pattern = this.pattern + let negate = false + let negateOffset = 0 + + for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate + } + + // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + matchOne (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') + } + + braceExpand () { + return braceExpand(this.pattern, this.options) + } + + parse (pattern, isSub) { + assertValidPattern(pattern) + + const options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + let re = '' + let hasMagic = !!options.nocase + let escaping = false + // ? => one single character + const patternListStack = [] + const negativeLists = [] + let stateChar + let inClass = false + let reClassStart = -1 + let classStart = -1 + let cs + let pl + let sp + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + const patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + + const clearStateChar = () => { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + this.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping) { + /* istanbul ignore next - completely not allowed, even escaped. */ + if (c === '/') { + return false + } + + if (reSpecials[c]) { + re += '\\' + } + re += c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + this.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length) { + re += '\\|' + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (reSpecials[c] && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + break + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + let tail + tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => { + /* istanbul ignore else - should already be done */ + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + const t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + const addPatternStart = addPatternStartSet[re.charAt(0)] + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (let n = negativeLists.length - 1; n > -1; n--) { + const nl = negativeLists[n] + + const nlBefore = re.slice(0, nl.reStart) + const nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + let nlAfter = re.slice(nl.reEnd) + const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + const openParensBefore = nlBefore.split('(').length - 1 + let cleanAfter = nlAfter + for (let i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + const dollar = nlAfter === '' && isSub !== SUBPARSE ? '$' : '' + re = nlBefore + nlFirst + nlAfter + dollar + nlLast + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + const flags = options.nocase ? 'i' : '' + try { + return Object.assign(new RegExp('^' + re + '$', flags), { + _glob: pattern, + _src: re, + }) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + } + + makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + const set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + const options = this.options + + const twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + const flags = options.nocase ? 'i' : '' + + // coalesce globstars and regexpify non-globstar patterns + // if it's the only item, then we just do one twoStar + // if it's the first, and there are more, prepend (\/|twoStar\/)? to next + // if it's the last, append (\/twoStar|) to previous + // if it's in the middle, append (\/|\/twoStar\/) to previous + // then filter out GLOBSTAR symbols + let re = set.map(pattern => { + pattern = pattern.map(p => + typeof p === 'string' ? regExpEscape(p) + : p === GLOBSTAR ? GLOBSTAR + : p._src + ).reduce((set, p) => { + if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) { + set.push(p) + } + return set + }, []) + pattern.forEach((p, i) => { + if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) { + return + } + if (i === 0) { + if (pattern.length > 1) { + pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1] + } else { + pattern[i] = twoStar + } + } else if (i === pattern.length - 1) { + pattern[i-1] += '(?:\\\/|' + twoStar + ')?' + } else { + pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1] + pattern[i+1] = GLOBSTAR + } + }) + return pattern.filter(p => p !== GLOBSTAR).join('/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp + } + + match (f, partial = this.partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + const options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + const set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + let filename + for (let i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (let i = 0; i < set.length; i++) { + const pattern = set[i] + let file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + const hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate + } + + static defaults (def) { + return minimatch.defaults(def).Minimatch + } +} + +minimatch.Minimatch = Minimatch + + /***/ }), /***/ 1374: @@ -12408,45 +13935,8 @@ var request = __nccwpck_require__(36234); var graphql = __nccwpck_require__(88467); var authToken = __nccwpck_require__(40334); -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; +const VERSION = "4.0.5"; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - - return target; -} - -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - - var target = _objectWithoutPropertiesLoose(source, excluded); - - var key, i; - - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - - return target; -} - -const VERSION = "3.6.0"; - -const _excluded = ["authStrategy"]; class Octokit { constructor(options = {}) { const hook = new beforeAfterHook.Collection(); @@ -12506,10 +13996,9 @@ class Octokit { } } else { const { - authStrategy - } = options, - otherOptions = _objectWithoutProperties(options, _excluded); - + authStrategy, + ...otherOptions + } = options; const auth = authStrategy(Object.assign({ request: this.request, log: this.log, @@ -12906,8 +14395,6 @@ function parse(options) { } else { if (Object.keys(remainingParameters).length) { body = remainingParameters; - } else { - headers["content-length"] = 0; } } } // default content-type for JSON if body is set @@ -12950,7 +14437,7 @@ function withDefaults(oldDefaults, newDefaults) { }); } -const VERSION = "6.0.12"; +const VERSION = "7.0.2"; const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. // So we use RequestParameters and add method as additional required property. @@ -12987,7 +14474,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); var request = __nccwpck_require__(36234); var universalUserAgent = __nccwpck_require__(45030); -const VERSION = "4.8.0"; +const VERSION = "5.0.1"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors:\n` + data.errors.map(e => ` - ${e.message}`).join("\n"); @@ -13110,60 +14597,7 @@ exports.withCustomRequest = withCustomRequest; Object.defineProperty(exports, "__esModule", ({ value: true })); -const VERSION = "2.17.0"; - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } - - keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} +const VERSION = "4.2.2"; /** * Some “list” response that can be paginated have a different response structure @@ -13184,9 +14618,9 @@ function _defineProperty(obj, key, value) { function normalizePaginatedListResponse(response) { // endpoints can respond with 204 if repository is empty if (!response.data) { - return _objectSpread2(_objectSpread2({}, response), {}, { + return { ...response, data: [] - }); + }; } const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); @@ -13294,7 +14728,7 @@ const composePaginateRest = Object.assign(paginate, { iterator }); -const paginatingEndpoints = ["GET /app/hook/deliveries", "GET /app/installations", "GET /applications/grants", "GET /authorizations", "GET /enterprises/{enterprise}/actions/permissions/organizations", "GET /enterprises/{enterprise}/actions/runner-groups", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners", "GET /enterprises/{enterprise}/actions/runners", "GET /enterprises/{enterprise}/actions/runners/downloads", "GET /events", "GET /gists", "GET /gists/public", "GET /gists/starred", "GET /gists/{gist_id}/comments", "GET /gists/{gist_id}/commits", "GET /gists/{gist_id}/forks", "GET /installation/repositories", "GET /issues", "GET /marketplace_listing/plans", "GET /marketplace_listing/plans/{plan_id}/accounts", "GET /marketplace_listing/stubbed/plans", "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts", "GET /networks/{owner}/{repo}/events", "GET /notifications", "GET /organizations", "GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/runners/downloads", "GET /orgs/{org}/actions/secrets", "GET /orgs/{org}/actions/secrets/{secret_name}/repositories", "GET /orgs/{org}/blocks", "GET /orgs/{org}/credential-authorizations", "GET /orgs/{org}/events", "GET /orgs/{org}/failed_invitations", "GET /orgs/{org}/hooks", "GET /orgs/{org}/hooks/{hook_id}/deliveries", "GET /orgs/{org}/installations", "GET /orgs/{org}/invitations", "GET /orgs/{org}/invitations/{invitation_id}/teams", "GET /orgs/{org}/issues", "GET /orgs/{org}/members", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/projects", "GET /orgs/{org}/public_members", "GET /orgs/{org}/repos", "GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/team-sync/groups", "GET /orgs/{org}/teams", "GET /orgs/{org}/teams/{team_slug}/discussions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/invitations", "GET /orgs/{org}/teams/{team_slug}/members", "GET /orgs/{org}/teams/{team_slug}/projects", "GET /orgs/{org}/teams/{team_slug}/repos", "GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings", "GET /orgs/{org}/teams/{team_slug}/teams", "GET /projects/columns/{column_id}/cards", "GET /projects/{project_id}/collaborators", "GET /projects/{project_id}/columns", "GET /repos/{owner}/{repo}/actions/artifacts", "GET /repos/{owner}/{repo}/actions/runners", "GET /repos/{owner}/{repo}/actions/runners/downloads", "GET /repos/{owner}/{repo}/actions/runs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs", "GET /repos/{owner}/{repo}/actions/secrets", "GET /repos/{owner}/{repo}/actions/workflows", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", "GET /repos/{owner}/{repo}/assignees", "GET /repos/{owner}/{repo}/autolinks", "GET /repos/{owner}/{repo}/branches", "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", "GET /repos/{owner}/{repo}/code-scanning/alerts", "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", "GET /repos/{owner}/{repo}/code-scanning/analyses", "GET /repos/{owner}/{repo}/collaborators", "GET /repos/{owner}/{repo}/comments", "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/commits", "GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head", "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments", "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", "GET /repos/{owner}/{repo}/commits/{ref}/check-runs", "GET /repos/{owner}/{repo}/commits/{ref}/check-suites", "GET /repos/{owner}/{repo}/commits/{ref}/statuses", "GET /repos/{owner}/{repo}/contributors", "GET /repos/{owner}/{repo}/deployments", "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses", "GET /repos/{owner}/{repo}/events", "GET /repos/{owner}/{repo}/forks", "GET /repos/{owner}/{repo}/git/matching-refs/{ref}", "GET /repos/{owner}/{repo}/hooks", "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries", "GET /repos/{owner}/{repo}/invitations", "GET /repos/{owner}/{repo}/issues", "GET /repos/{owner}/{repo}/issues/comments", "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/issues/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/comments", "GET /repos/{owner}/{repo}/issues/{issue_number}/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/labels", "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", "GET /repos/{owner}/{repo}/keys", "GET /repos/{owner}/{repo}/labels", "GET /repos/{owner}/{repo}/milestones", "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels", "GET /repos/{owner}/{repo}/notifications", "GET /repos/{owner}/{repo}/pages/builds", "GET /repos/{owner}/{repo}/projects", "GET /repos/{owner}/{repo}/pulls", "GET /repos/{owner}/{repo}/pulls/comments", "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", "GET /repos/{owner}/{repo}/pulls/{pull_number}/files", "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments", "GET /repos/{owner}/{repo}/releases", "GET /repos/{owner}/{repo}/releases/{release_id}/assets", "GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/stargazers", "GET /repos/{owner}/{repo}/subscribers", "GET /repos/{owner}/{repo}/tags", "GET /repos/{owner}/{repo}/teams", "GET /repositories", "GET /repositories/{repository_id}/environments/{environment_name}/secrets", "GET /scim/v2/enterprises/{enterprise}/Groups", "GET /scim/v2/enterprises/{enterprise}/Users", "GET /scim/v2/organizations/{org}/Users", "GET /search/code", "GET /search/commits", "GET /search/issues", "GET /search/labels", "GET /search/repositories", "GET /search/topics", "GET /search/users", "GET /teams/{team_id}/discussions", "GET /teams/{team_id}/discussions/{discussion_number}/comments", "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /teams/{team_id}/discussions/{discussion_number}/reactions", "GET /teams/{team_id}/invitations", "GET /teams/{team_id}/members", "GET /teams/{team_id}/projects", "GET /teams/{team_id}/repos", "GET /teams/{team_id}/team-sync/group-mappings", "GET /teams/{team_id}/teams", "GET /user/blocks", "GET /user/emails", "GET /user/followers", "GET /user/following", "GET /user/gpg_keys", "GET /user/installations", "GET /user/installations/{installation_id}/repositories", "GET /user/issues", "GET /user/keys", "GET /user/marketplace_purchases", "GET /user/marketplace_purchases/stubbed", "GET /user/memberships/orgs", "GET /user/migrations", "GET /user/migrations/{migration_id}/repositories", "GET /user/orgs", "GET /user/packages", "GET /user/public_emails", "GET /user/repos", "GET /user/repository_invitations", "GET /user/starred", "GET /user/subscriptions", "GET /user/teams", "GET /users", "GET /users/{username}/events", "GET /users/{username}/events/orgs/{org}", "GET /users/{username}/events/public", "GET /users/{username}/followers", "GET /users/{username}/following", "GET /users/{username}/gists", "GET /users/{username}/gpg_keys", "GET /users/{username}/keys", "GET /users/{username}/orgs", "GET /users/{username}/packages", "GET /users/{username}/projects", "GET /users/{username}/received_events", "GET /users/{username}/received_events/public", "GET /users/{username}/repos", "GET /users/{username}/starred", "GET /users/{username}/subscriptions"]; +const paginatingEndpoints = ["GET /app/hook/deliveries", "GET /app/installations", "GET /enterprises/{enterprise}/actions/permissions/organizations", "GET /enterprises/{enterprise}/actions/runner-groups", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners", "GET /enterprises/{enterprise}/actions/runners", "GET /enterprises/{enterprise}/audit-log", "GET /enterprises/{enterprise}/code-scanning/alerts", "GET /enterprises/{enterprise}/secret-scanning/alerts", "GET /enterprises/{enterprise}/settings/billing/advanced-security", "GET /events", "GET /gists", "GET /gists/public", "GET /gists/starred", "GET /gists/{gist_id}/comments", "GET /gists/{gist_id}/commits", "GET /gists/{gist_id}/forks", "GET /installation/repositories", "GET /issues", "GET /licenses", "GET /marketplace_listing/plans", "GET /marketplace_listing/plans/{plan_id}/accounts", "GET /marketplace_listing/stubbed/plans", "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts", "GET /networks/{owner}/{repo}/events", "GET /notifications", "GET /organizations", "GET /orgs/{org}/actions/cache/usage-by-repository", "GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/secrets", "GET /orgs/{org}/actions/secrets/{secret_name}/repositories", "GET /orgs/{org}/audit-log", "GET /orgs/{org}/blocks", "GET /orgs/{org}/code-scanning/alerts", "GET /orgs/{org}/codespaces", "GET /orgs/{org}/credential-authorizations", "GET /orgs/{org}/dependabot/secrets", "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories", "GET /orgs/{org}/events", "GET /orgs/{org}/external-groups", "GET /orgs/{org}/failed_invitations", "GET /orgs/{org}/hooks", "GET /orgs/{org}/hooks/{hook_id}/deliveries", "GET /orgs/{org}/installations", "GET /orgs/{org}/invitations", "GET /orgs/{org}/invitations/{invitation_id}/teams", "GET /orgs/{org}/issues", "GET /orgs/{org}/members", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", "GET /orgs/{org}/projects", "GET /orgs/{org}/public_members", "GET /orgs/{org}/repos", "GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/settings/billing/advanced-security", "GET /orgs/{org}/team-sync/groups", "GET /orgs/{org}/teams", "GET /orgs/{org}/teams/{team_slug}/discussions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/invitations", "GET /orgs/{org}/teams/{team_slug}/members", "GET /orgs/{org}/teams/{team_slug}/projects", "GET /orgs/{org}/teams/{team_slug}/repos", "GET /orgs/{org}/teams/{team_slug}/teams", "GET /projects/columns/{column_id}/cards", "GET /projects/{project_id}/collaborators", "GET /projects/{project_id}/columns", "GET /repos/{owner}/{repo}/actions/artifacts", "GET /repos/{owner}/{repo}/actions/caches", "GET /repos/{owner}/{repo}/actions/runners", "GET /repos/{owner}/{repo}/actions/runs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs", "GET /repos/{owner}/{repo}/actions/secrets", "GET /repos/{owner}/{repo}/actions/workflows", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", "GET /repos/{owner}/{repo}/assignees", "GET /repos/{owner}/{repo}/branches", "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", "GET /repos/{owner}/{repo}/code-scanning/alerts", "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", "GET /repos/{owner}/{repo}/code-scanning/analyses", "GET /repos/{owner}/{repo}/codespaces", "GET /repos/{owner}/{repo}/codespaces/devcontainers", "GET /repos/{owner}/{repo}/codespaces/secrets", "GET /repos/{owner}/{repo}/collaborators", "GET /repos/{owner}/{repo}/comments", "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/commits", "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments", "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", "GET /repos/{owner}/{repo}/commits/{ref}/check-runs", "GET /repos/{owner}/{repo}/commits/{ref}/check-suites", "GET /repos/{owner}/{repo}/commits/{ref}/status", "GET /repos/{owner}/{repo}/commits/{ref}/statuses", "GET /repos/{owner}/{repo}/contributors", "GET /repos/{owner}/{repo}/dependabot/secrets", "GET /repos/{owner}/{repo}/deployments", "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses", "GET /repos/{owner}/{repo}/environments", "GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies", "GET /repos/{owner}/{repo}/events", "GET /repos/{owner}/{repo}/forks", "GET /repos/{owner}/{repo}/hooks", "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries", "GET /repos/{owner}/{repo}/invitations", "GET /repos/{owner}/{repo}/issues", "GET /repos/{owner}/{repo}/issues/comments", "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/issues/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/comments", "GET /repos/{owner}/{repo}/issues/{issue_number}/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/labels", "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", "GET /repos/{owner}/{repo}/keys", "GET /repos/{owner}/{repo}/labels", "GET /repos/{owner}/{repo}/milestones", "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels", "GET /repos/{owner}/{repo}/notifications", "GET /repos/{owner}/{repo}/pages/builds", "GET /repos/{owner}/{repo}/projects", "GET /repos/{owner}/{repo}/pulls", "GET /repos/{owner}/{repo}/pulls/comments", "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", "GET /repos/{owner}/{repo}/pulls/{pull_number}/files", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments", "GET /repos/{owner}/{repo}/releases", "GET /repos/{owner}/{repo}/releases/{release_id}/assets", "GET /repos/{owner}/{repo}/releases/{release_id}/reactions", "GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations", "GET /repos/{owner}/{repo}/stargazers", "GET /repos/{owner}/{repo}/subscribers", "GET /repos/{owner}/{repo}/tags", "GET /repos/{owner}/{repo}/teams", "GET /repos/{owner}/{repo}/topics", "GET /repositories", "GET /repositories/{repository_id}/environments/{environment_name}/secrets", "GET /search/code", "GET /search/commits", "GET /search/issues", "GET /search/labels", "GET /search/repositories", "GET /search/topics", "GET /search/users", "GET /teams/{team_id}/discussions", "GET /teams/{team_id}/discussions/{discussion_number}/comments", "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /teams/{team_id}/discussions/{discussion_number}/reactions", "GET /teams/{team_id}/invitations", "GET /teams/{team_id}/members", "GET /teams/{team_id}/projects", "GET /teams/{team_id}/repos", "GET /teams/{team_id}/teams", "GET /user/blocks", "GET /user/codespaces", "GET /user/codespaces/secrets", "GET /user/emails", "GET /user/followers", "GET /user/following", "GET /user/gpg_keys", "GET /user/installations", "GET /user/installations/{installation_id}/repositories", "GET /user/issues", "GET /user/keys", "GET /user/marketplace_purchases", "GET /user/marketplace_purchases/stubbed", "GET /user/memberships/orgs", "GET /user/migrations", "GET /user/migrations/{migration_id}/repositories", "GET /user/orgs", "GET /user/packages", "GET /user/packages/{package_type}/{package_name}/versions", "GET /user/public_emails", "GET /user/repos", "GET /user/repository_invitations", "GET /user/ssh_signing_keys", "GET /user/starred", "GET /user/subscriptions", "GET /user/teams", "GET /users", "GET /users/{username}/events", "GET /users/{username}/events/orgs/{org}", "GET /users/{username}/events/public", "GET /users/{username}/followers", "GET /users/{username}/following", "GET /users/{username}/gists", "GET /users/{username}/gpg_keys", "GET /users/{username}/keys", "GET /users/{username}/orgs", "GET /users/{username}/packages", "GET /users/{username}/projects", "GET /users/{username}/received_events", "GET /users/{username}/received_events/public", "GET /users/{username}/repos", "GET /users/{username}/ssh_signing_keys", "GET /users/{username}/starred", "GET /users/{username}/subscriptions"]; function isPaginatingEndpoint(arg) { if (typeof arg === "string") { @@ -13373,61 +14807,10 @@ exports.requestLog = requestLog; Object.defineProperty(exports, "__esModule", ({ value: true })); -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } - - keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - const Endpoints = { actions: { + addCustomLabelsToSelfHostedRunnerForOrg: ["POST /orgs/{org}/actions/runners/{runner_id}/labels"], + addCustomLabelsToSelfHostedRunnerForRepo: ["POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], approveWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"], cancelWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"], @@ -13439,6 +14822,8 @@ const Endpoints = { createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"], createRemoveTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/remove-token"], createWorkflowDispatch: ["POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"], + deleteActionsCacheById: ["DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"], + deleteActionsCacheByKey: ["DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"], deleteArtifact: ["DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], deleteEnvironmentSecret: ["DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"], @@ -13455,11 +14840,19 @@ const Endpoints = { downloadWorkflowRunLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], enableSelectedRepositoryGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"], enableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"], + getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"], + getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"], + getActionsCacheUsageByRepoForOrg: ["GET /orgs/{org}/actions/cache/usage-by-repository"], + getActionsCacheUsageForEnterprise: ["GET /enterprises/{enterprise}/actions/cache/usage"], + getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"], getAllowedActionsOrganization: ["GET /orgs/{org}/actions/permissions/selected-actions"], getAllowedActionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/selected-actions"], getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], getEnvironmentPublicKey: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key"], getEnvironmentSecret: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + getGithubActionsDefaultWorkflowPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsOrganization: ["GET /orgs/{org}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/workflow"], getGithubActionsPermissionsOrganization: ["GET /orgs/{org}/actions/permissions"], getGithubActionsPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions"], getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], @@ -13475,6 +14868,7 @@ const Endpoints = { getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"], getSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}"], getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"], + getWorkflowAccessToRepository: ["GET /repos/{owner}/{repo}/actions/permissions/access"], getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"], getWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"], getWorkflowRunUsage: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"], @@ -13483,6 +14877,8 @@ const Endpoints = { listEnvironmentSecrets: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets"], listJobsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"], listJobsForWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"], + listLabelsForSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}/labels"], + listLabelsForSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], listOrgSecrets: ["GET /orgs/{org}/actions/secrets"], listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"], listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"], @@ -13495,14 +14891,27 @@ const Endpoints = { listWorkflowRunArtifacts: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"], listWorkflowRuns: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"], listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"], + reRunJobForWorkflowRun: ["POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun"], + reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"], + reRunWorkflowFailedJobs: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs"], + removeAllCustomLabelsFromSelfHostedRunnerForOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}/labels"], + removeAllCustomLabelsFromSelfHostedRunnerForRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + removeCustomLabelFromSelfHostedRunnerForOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name}"], + removeCustomLabelFromSelfHostedRunnerForRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name}"], removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], reviewPendingDeploymentsForRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"], setAllowedActionsOrganization: ["PUT /orgs/{org}/actions/permissions/selected-actions"], setAllowedActionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"], + setCustomLabelsForSelfHostedRunnerForOrg: ["PUT /orgs/{org}/actions/runners/{runner_id}/labels"], + setCustomLabelsForSelfHostedRunnerForRepo: ["PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + setGithubActionsDefaultWorkflowPermissionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/workflow"], + setGithubActionsDefaultWorkflowPermissionsOrganization: ["PUT /orgs/{org}/actions/permissions/workflow"], + setGithubActionsDefaultWorkflowPermissionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/workflow"], setGithubActionsPermissionsOrganization: ["PUT /orgs/{org}/actions/permissions"], setGithubActionsPermissionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions"], setSelectedReposForOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"], - setSelectedRepositoriesEnabledGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories"] + setSelectedRepositoriesEnabledGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories"], + setWorkflowAccessToRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/access"] }, activity: { checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"], @@ -13543,16 +14952,6 @@ const Endpoints = { }], addRepoToInstallationForAuthenticatedUser: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"], checkToken: ["POST /applications/{client_id}/token"], - createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", { - mediaType: { - previews: ["corsair"] - } - }], - createContentAttachmentForRepo: ["POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments", { - mediaType: { - previews: ["corsair"] - } - }], createFromManifest: ["POST /app-manifests/{code}/conversions"], createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"], deleteAuthorization: ["DELETE /applications/{client_id}/grant"], @@ -13594,6 +14993,8 @@ const Endpoints = { billing: { getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"], getGithubActionsBillingUser: ["GET /users/{username}/settings/billing/actions"], + getGithubAdvancedSecurityBillingGhe: ["GET /enterprises/{enterprise}/settings/billing/advanced-security"], + getGithubAdvancedSecurityBillingOrg: ["GET /orgs/{org}/settings/billing/advanced-security"], getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"], getGithubPackagesBillingUser: ["GET /users/{username}/settings/billing/packages"], getSharedStorageBillingOrg: ["GET /orgs/{org}/settings/billing/shared-storage"], @@ -13623,6 +15024,8 @@ const Endpoints = { getAnalysis: ["GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"], getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"], listAlertInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"], + listAlertsForEnterprise: ["GET /enterprises/{enterprise}/code-scanning/alerts"], + listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"], listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"], listAlertsInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", {}, { renamed: ["codeScanning", "listAlertInstances"] @@ -13635,16 +15038,81 @@ const Endpoints = { getAllCodesOfConduct: ["GET /codes_of_conduct"], getConductCode: ["GET /codes_of_conduct/{key}"] }, + codespaces: { + addRepositoryForSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"], + codespaceMachinesForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}/machines"], + createForAuthenticatedUser: ["POST /user/codespaces"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + createOrUpdateSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}"], + createWithPrForAuthenticatedUser: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"], + createWithRepoForAuthenticatedUser: ["POST /repos/{owner}/{repo}/codespaces"], + deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"], + deleteFromOrganization: ["DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + deleteSecretForAuthenticatedUser: ["DELETE /user/codespaces/secrets/{secret_name}"], + exportForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/exports"], + getExportDetailsForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}/exports/{export_id}"], + getForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}"], + getPublicKeyForAuthenticatedUser: ["GET /user/codespaces/secrets/public-key"], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/codespaces/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + getSecretForAuthenticatedUser: ["GET /user/codespaces/secrets/{secret_name}"], + listDevcontainersInRepositoryForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/devcontainers"], + listForAuthenticatedUser: ["GET /user/codespaces"], + listInOrganization: ["GET /orgs/{org}/codespaces", {}, { + renamedParameters: { + org_id: "org" + } + }], + listInRepositoryForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/codespaces/secrets"], + listRepositoriesForSecretForAuthenticatedUser: ["GET /user/codespaces/secrets/{secret_name}/repositories"], + listSecretsForAuthenticatedUser: ["GET /user/codespaces/secrets"], + preFlightWithRepoForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/new"], + removeRepositoryForSecretForAuthenticatedUser: ["DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"], + repoMachinesForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/machines"], + setRepositoriesForSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}/repositories"], + startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"], + stopForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/stop"], + stopInOrganization: ["POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop"], + updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"] + }, + dependabot: { + addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"], + createOrUpdateOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + deleteOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + getOrgPublicKey: ["GET /orgs/{org}/dependabot/secrets/public-key"], + getOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}"], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/dependabot/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + listOrgSecrets: ["GET /orgs/{org}/dependabot/secrets"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/dependabot/secrets"], + listSelectedReposForOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories"], + removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"], + setSelectedReposForOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories"] + }, + dependencyGraph: { + createRepositorySnapshot: ["POST /repos/{owner}/{repo}/dependency-graph/snapshots"], + diffRange: ["GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"] + }, emojis: { get: ["GET /emojis"] }, enterpriseAdmin: { + addCustomLabelsToSelfHostedRunnerForEnterprise: ["POST /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], disableSelectedOrganizationGithubActionsEnterprise: ["DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id}"], enableSelectedOrganizationGithubActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}"], getAllowedActionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/selected-actions"], getGithubActionsPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions"], + getServerStatistics: ["GET /enterprise-installation/{enterprise_or_org}/server-statistics"], + listLabelsForSelfHostedRunnerForEnterprise: ["GET /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], listSelectedOrganizationsEnabledGithubActionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/organizations"], + removeAllCustomLabelsFromSelfHostedRunnerForEnterprise: ["DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + removeCustomLabelFromSelfHostedRunnerForEnterprise: ["DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels/{name}"], setAllowedActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/selected-actions"], + setCustomLabelsForSelfHostedRunnerForEnterprise: ["PUT /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], setGithubActionsPermissionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions"], setSelectedOrganizationsEnabledGithubActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/organizations"] }, @@ -13797,15 +15265,19 @@ const Endpoints = { updateImport: ["PATCH /repos/{owner}/{repo}/import"] }, orgs: { + addSecurityManagerTeam: ["PUT /orgs/{org}/security-managers/teams/{team_slug}"], blockUser: ["PUT /orgs/{org}/blocks/{username}"], cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"], checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], checkMembershipForUser: ["GET /orgs/{org}/members/{username}"], checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"], convertMemberToOutsideCollaborator: ["PUT /orgs/{org}/outside_collaborators/{username}"], + createCustomRole: ["POST /orgs/{org}/custom_roles"], createInvitation: ["POST /orgs/{org}/invitations"], createWebhook: ["POST /orgs/{org}/hooks"], + deleteCustomRole: ["DELETE /orgs/{org}/custom_roles/{role_id}"], deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], + enableOrDisableSecurityProductOnAllOrgRepos: ["POST /orgs/{org}/{security_product}/{enablement}"], get: ["GET /orgs/{org}"], getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], @@ -13815,7 +15287,9 @@ const Endpoints = { list: ["GET /organizations"], listAppInstallations: ["GET /orgs/{org}/installations"], listBlockedUsers: ["GET /orgs/{org}/blocks"], + listCustomRoles: ["GET /organizations/{organization_id}/custom_roles"], listFailedInvitations: ["GET /orgs/{org}/failed_invitations"], + listFineGrainedPermissions: ["GET /orgs/{org}/fine_grained_permissions"], listForAuthenticatedUser: ["GET /user/orgs"], listForUser: ["GET /users/{username}/orgs"], listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], @@ -13824,6 +15298,7 @@ const Endpoints = { listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], listPendingInvitations: ["GET /orgs/{org}/invitations"], listPublicMembers: ["GET /orgs/{org}/public_members"], + listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"], listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"], listWebhooks: ["GET /orgs/{org}/hooks"], pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], @@ -13832,10 +15307,12 @@ const Endpoints = { removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"], removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"], removePublicMembershipForAuthenticatedUser: ["DELETE /orgs/{org}/public_members/{username}"], + removeSecurityManagerTeam: ["DELETE /orgs/{org}/security-managers/teams/{team_slug}"], setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], setPublicMembershipForAuthenticatedUser: ["PUT /orgs/{org}/public_members/{username}"], unblockUser: ["DELETE /orgs/{org}/blocks/{username}"], update: ["PATCH /orgs/{org}"], + updateCustomRole: ["PATCH /orgs/{org}/custom_roles/{role_id}"], updateMembershipForAuthenticatedUser: ["PATCH /user/memberships/orgs/{org}"], updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"], updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"] @@ -13943,12 +15420,14 @@ const Endpoints = { deleteForIssue: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}"], deleteForIssueComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}"], deleteForPullRequestComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}"], + deleteForRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}"], deleteForTeamDiscussion: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}"], deleteForTeamDiscussionComment: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}"], listForCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}/reactions"], listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions"], listForIssueComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"], listForPullRequestReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"], + listForRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}/reactions"], listForTeamDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"], listForTeamDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"] }, @@ -13972,6 +15451,7 @@ const Endpoints = { }], checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"], checkVulnerabilityAlerts: ["GET /repos/{owner}/{repo}/vulnerability-alerts"], + codeownersErrors: ["GET /repos/{owner}/{repo}/codeowners/errors"], compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"], compareCommitsWithBasehead: ["GET /repos/{owner}/{repo}/compare/{basehead}"], createAutolink: ["POST /repos/{owner}/{repo}/autolinks"], @@ -13980,6 +15460,7 @@ const Endpoints = { createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"], createDeployKey: ["POST /repos/{owner}/{repo}/keys"], createDeployment: ["POST /repos/{owner}/{repo}/deployments"], + createDeploymentBranchPolicy: ["POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"], createDeploymentStatus: ["POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"], createForAuthenticatedUser: ["POST /user/repos"], @@ -13987,8 +15468,10 @@ const Endpoints = { createInOrg: ["POST /orgs/{org}/repos"], createOrUpdateEnvironment: ["PUT /repos/{owner}/{repo}/environments/{environment_name}"], createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], + createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployment"], createPagesSite: ["POST /repos/{owner}/{repo}/pages"], createRelease: ["POST /repos/{owner}/{repo}/releases"], + createTagProtection: ["POST /repos/{owner}/{repo}/tags/protection"], createUsingTemplate: ["POST /repos/{template_owner}/{template_repo}/generate"], createWebhook: ["POST /repos/{owner}/{repo}/hooks"], declineInvitation: ["DELETE /user/repository_invitations/{invitation_id}", {}, { @@ -14005,12 +15488,14 @@ const Endpoints = { deleteCommitSignatureProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"], deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"], deleteDeployment: ["DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"], + deleteDeploymentBranchPolicy: ["DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"], deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"], deleteInvitation: ["DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"], deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"], deletePullRequestReviewProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"], deleteReleaseAsset: ["DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"], + deleteTagProtection: ["DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id}"], deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"], disableAutomatedSecurityFixes: ["DELETE /repos/{owner}/{repo}/automated-security-fixes"], disableLfsForRepo: ["DELETE /repos/{owner}/{repo}/lfs"], @@ -14029,11 +15514,7 @@ const Endpoints = { getAdminBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"], getAllStatusCheckContexts: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"], - getAllTopics: ["GET /repos/{owner}/{repo}/topics", { - mediaType: { - previews: ["mercy"] - } - }], + getAllTopics: ["GET /repos/{owner}/{repo}/topics"], getAppsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"], getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"], getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"], @@ -14051,6 +15532,7 @@ const Endpoints = { getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"], getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"], getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"], + getDeploymentBranchPolicy: ["GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"], getDeploymentStatus: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"], getEnvironment: ["GET /repos/{owner}/{repo}/environments/{environment_name}"], getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"], @@ -14085,6 +15567,7 @@ const Endpoints = { listCommits: ["GET /repos/{owner}/{repo}/commits"], listContributors: ["GET /repos/{owner}/{repo}/contributors"], listDeployKeys: ["GET /repos/{owner}/{repo}/keys"], + listDeploymentBranchPolicies: ["GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies"], listDeploymentStatuses: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], listDeployments: ["GET /repos/{owner}/{repo}/deployments"], listForAuthenticatedUser: ["GET /user/repos"], @@ -14099,6 +15582,7 @@ const Endpoints = { listPullRequestsAssociatedWithCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"], listReleaseAssets: ["GET /repos/{owner}/{repo}/releases/{release_id}/assets"], listReleases: ["GET /repos/{owner}/{repo}/releases"], + listTagProtection: ["GET /repos/{owner}/{repo}/tags/protection"], listTags: ["GET /repos/{owner}/{repo}/tags"], listTeams: ["GET /repos/{owner}/{repo}/teams"], listWebhookDeliveries: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"], @@ -14122,11 +15606,7 @@ const Endpoints = { mapToData: "users" }], renameBranch: ["POST /repos/{owner}/{repo}/branches/{branch}/rename"], - replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics", { - mediaType: { - previews: ["mercy"] - } - }], + replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics"], requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"], setAdminBranchProtection: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], setAppAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { @@ -14146,6 +15626,7 @@ const Endpoints = { update: ["PATCH /repos/{owner}/{repo}"], updateBranchProtection: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection"], updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"], + updateDeploymentBranchPolicy: ["PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id}"], updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"], updateInvitation: ["PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"], updatePullRequestReviewProtection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], @@ -14167,17 +15648,15 @@ const Endpoints = { issuesAndPullRequests: ["GET /search/issues"], labels: ["GET /search/labels"], repos: ["GET /search/repositories"], - topics: ["GET /search/topics", { - mediaType: { - previews: ["mercy"] - } - }], + topics: ["GET /search/topics"], users: ["GET /search/users"] }, secretScanning: { getAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"], + listAlertsForEnterprise: ["GET /enterprises/{enterprise}/secret-scanning/alerts"], listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"], listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"], + listLocationsForAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"], updateAlert: ["PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"] }, teams: { @@ -14229,6 +15708,7 @@ const Endpoints = { renamed: ["users", "createPublicSshKeyForAuthenticatedUser"] }], createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"], + createSshSigningKeyForAuthenticatedUser: ["POST /user/ssh_signing_keys"], deleteEmailForAuthenticated: ["DELETE /user/emails", {}, { renamed: ["users", "deleteEmailForAuthenticatedUser"] }], @@ -14241,6 +15721,7 @@ const Endpoints = { renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"] }], deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"], + deleteSshSigningKeyForAuthenticatedUser: ["DELETE /user/ssh_signing_keys/{ssh_signing_key_id}"], follow: ["PUT /user/following/{username}"], getAuthenticated: ["GET /user"], getByUsername: ["GET /users/{username}"], @@ -14253,6 +15734,7 @@ const Endpoints = { renamed: ["users", "getPublicSshKeyForAuthenticatedUser"] }], getPublicSshKeyForAuthenticatedUser: ["GET /user/keys/{key_id}"], + getSshSigningKeyForAuthenticatedUser: ["GET /user/ssh_signing_keys/{ssh_signing_key_id}"], list: ["GET /users"], listBlockedByAuthenticated: ["GET /user/blocks", {}, { renamed: ["users", "listBlockedByAuthenticatedUser"] @@ -14283,6 +15765,8 @@ const Endpoints = { renamed: ["users", "listPublicSshKeysForAuthenticatedUser"] }], listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"], + listSshSigningKeysForAuthenticatedUser: ["GET /user/ssh_signing_keys"], + listSshSigningKeysForUser: ["GET /users/{username}/ssh_signing_keys"], setPrimaryEmailVisibilityForAuthenticated: ["PATCH /user/email/visibility", {}, { renamed: ["users", "setPrimaryEmailVisibilityForAuthenticatedUser"] }], @@ -14293,7 +15777,7 @@ const Endpoints = { } }; -const VERSION = "5.13.0"; +const VERSION = "6.5.0"; function endpointsToMethods(octokit, endpointsMap) { const newMethods = {}; @@ -14385,9 +15869,9 @@ function restEndpointMethods(octokit) { restEndpointMethods.VERSION = VERSION; function legacyRestEndpointMethods(octokit) { const api = endpointsToMethods(octokit, Endpoints); - return _objectSpread2(_objectSpread2({}, api), {}, { + return { ...api, rest: api - }); + }; } legacyRestEndpointMethods.VERSION = VERSION; @@ -14496,7 +15980,7 @@ var isPlainObject = __nccwpck_require__(63287); var nodeFetch = _interopDefault(__nccwpck_require__(80467)); var requestError = __nccwpck_require__(10537); -const VERSION = "5.6.3"; +const VERSION = "6.2.1"; function getBufferResponse(response) { return response.arrayBuffer(); @@ -14512,7 +15996,9 @@ function fetchWrapper(requestOptions) { let headers = {}; let status; let url; - const fetch = requestOptions.request && requestOptions.request.fetch || nodeFetch; + const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || + /* istanbul ignore next */ + nodeFetch; return fetch(requestOptions.url, Object.assign({ method: requestOptions.method, body: requestOptions.body, @@ -14590,7 +16076,7 @@ function fetchWrapper(requestOptions) { data }; }).catch(error => { - if (error instanceof requestError.RequestError) throw error; + if (error instanceof requestError.RequestError) throw error;else if (error.name === "AbortError") throw error; throw new requestError.RequestError(error.message, 500, { request: requestOptions }); @@ -14678,7 +16164,7 @@ var pluginRequestLog = __nccwpck_require__(68883); var pluginPaginateRest = __nccwpck_require__(64193); var pluginRestEndpointMethods = __nccwpck_require__(83044); -const VERSION = "18.12.0"; +const VERSION = "19.0.4"; const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.legacyRestEndpointMethods, pluginPaginateRest.paginateRest).defaults({ userAgent: `octokit-rest.js/${VERSION}` @@ -18290,6 +19776,76 @@ function retry(fn, opts) { module.exports = retry; +/***/ }), + +/***/ 9417: +/***/ ((module) => { + +"use strict"; + +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + + /***/ }), /***/ 83682: @@ -19226,6 +20782,7 @@ function addPullRequestDefaults(options) { ? options.primary : DEFAULT_PRIMARY_BRANCH, maintainersCanModify: options.maintainersCanModify === false ? false : true, + filesPerCommit: options.filesPerCommit, }; return pullRequestSettings; } @@ -19396,8 +20953,10 @@ exports.branch = branch; // See the License for the specific language governing permissions and // limitations under the License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.commitAndPush = exports.updateRef = exports.createCommit = exports.createTree = exports.generateTreeObjects = void 0; +exports.commitAndPush = exports.updateRef = exports.createTree = exports.generateTreeObjects = void 0; const logger_1 = __nccwpck_require__(58192); +const create_commit_1 = __nccwpck_require__(93018); +const DEFAULT_FILES_PER_COMMIT = 100; /** * Generate and return a GitHub tree object structure * containing the target change data @@ -19430,6 +20989,11 @@ function generateTreeObjects(changes) { return tree; } exports.generateTreeObjects = generateTreeObjects; +function* inGroupsOf(all, groupSize) { + for (let i = 0; i < all.length; i += groupSize) { + yield all.slice(i, i + groupSize); + } +} /** * Upload and create a remote GitHub tree * and resolves with the new tree SHA. @@ -19457,29 +21021,6 @@ async function createTree(octokit, origin, refHead, tree) { return treeSha; } exports.createTree = createTree; -/** - * Create a commit with a repo snapshot SHA on top of the reference HEAD - * and resolves with the SHA of the commit. - * Rejects if GitHub V3 API fails with the GitHub error response - * @param {Octokit} octokit The authenticated octokit instance - * @param {RepoDomain} origin the the remote repository to push changes to - * @param {string} refHead the base of the new commit(s) - * @param {string} treeSha the tree SHA that this commit will point to - * @param {string} message the message of the new commit - * @returns {Promise} the new commit SHA - */ -async function createCommit(octokit, origin, refHead, treeSha, message) { - const commitData = (await octokit.git.createCommit({ - owner: origin.owner, - repo: origin.repo, - message, - tree: treeSha, - parents: [refHead], - })).data; - logger_1.logger.info(`Successfully created commit. See commit at ${commitData.url}`); - return commitData.sha; -} -exports.createCommit = createCommit; /** * Update a reference to a SHA * Rejects if GitHub V3 API fails with the GitHub error response @@ -19513,12 +21054,14 @@ exports.updateRef = updateRef; * @param {boolean} force to force the commit changes given refHead * @returns {Promise} */ -async function commitAndPush(octokit, refHead, changes, originBranch, commitMessage, force) { +async function commitAndPush(octokit, refHead, changes, originBranch, commitMessage, force, filesPerCommit = DEFAULT_FILES_PER_COMMIT) { try { const tree = generateTreeObjects(changes); - const treeSha = await createTree(octokit, originBranch, refHead, tree); - const commitSha = await createCommit(octokit, originBranch, refHead, treeSha, commitMessage); - await updateRef(octokit, originBranch, commitSha, force); + for (const treeGroup of inGroupsOf(tree, filesPerCommit)) { + const treeSha = await createTree(octokit, originBranch, refHead, treeGroup); + refHead = await (0, create_commit_1.createCommit)(octokit, originBranch, refHead, treeSha, commitMessage); + } + await updateRef(octokit, originBranch, refHead, force); } catch (err) { err.message = `Error while creating a tree and updating the ref: ${err.message}`; @@ -19531,6 +21074,54 @@ exports.commitAndPush = commitAndPush; /***/ }), +/***/ 93018: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createCommit = void 0; +const logger_1 = __nccwpck_require__(58192); +/** + * Create a commit with a repo snapshot SHA on top of the reference HEAD + * and resolves with the SHA of the commit. + * Rejects if GitHub V3 API fails with the GitHub error response + * @param {Octokit} octokit The authenticated octokit instance + * @param {RepoDomain} origin the the remote repository to push changes to + * @param {string} refHead the base of the new commit(s) + * @param {string} treeSha the tree SHA that this commit will point to + * @param {string} message the message of the new commit + * @returns {Promise} the new commit SHA + */ +async function createCommit(octokit, origin, refHead, treeSha, message) { + const commitData = (await octokit.git.createCommit({ + owner: origin.owner, + repo: origin.repo, + message, + tree: treeSha, + parents: [refHead], + })).data; + logger_1.logger.info(`Successfully created commit. See commit at ${commitData.url}`); + return commitData.sha; +} +exports.createCommit = createCommit; +//# sourceMappingURL=create-commit.js.map + +/***/ }), + /***/ 67386: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -20071,7 +21662,7 @@ async function createPullRequest(octokit, changes, options) { logger_1.logger.info(`Retry attempt #${attempt}...`); }, }); - await (0, commit_and_push_1.commitAndPush)(octokit, refHeadSha, changes, originBranch, gitHubConfigs.message, gitHubConfigs.force); + await (0, commit_and_push_1.commitAndPush)(octokit, refHeadSha, changes, originBranch, gitHubConfigs.message, gitHubConfigs.force, gitHubConfigs.filesPerCommit); const description = { body: gitHubConfigs.description, title: gitHubConfigs.title, @@ -79759,7 +81350,7 @@ function parseCommits(message) { * more commits returned as a single raw commit may contain multiple release * messages. */ -function parseConventionalCommits(commits) { +function parseConventionalCommits(commits, logger = logger_1.logger) { const conventionalCommits = []; for (const commit of commits) { const commitMessage = preprocessCommitMessage(commit); @@ -79782,7 +81373,7 @@ function parseConventionalCommits(commits) { } } catch (_err) { - logger_1.logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`); + logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`); } } return conventionalCommits; @@ -79964,11 +81555,13 @@ const cargo_workspace_1 = __nccwpck_require__(77430); const node_workspace_1 = __nccwpck_require__(23256); const maven_workspace_1 = __nccwpck_require__(66113); const errors_1 = __nccwpck_require__(93637); +const sentence_case_1 = __nccwpck_require__(36662); const pluginFactories = { 'linked-versions': options => new linked_versions_1.LinkedVersions(options.github, options.targetBranch, options.repositoryConfig, options.type.groupName, options.type.components), 'cargo-workspace': options => new cargo_workspace_1.CargoWorkspace(options.github, options.targetBranch, options.repositoryConfig, options), 'node-workspace': options => new node_workspace_1.NodeWorkspace(options.github, options.targetBranch, options.repositoryConfig, options), 'maven-workspace': options => new maven_workspace_1.MavenWorkspace(options.github, options.targetBranch, options.repositoryConfig, options), + 'sentence-case': options => new sentence_case_1.SentenceCase(options.github, options.targetBranch, options.repositoryConfig, options.type.specialWords), }; function buildPlugin(options) { if (typeof options.type === 'object') { @@ -80236,9 +81829,10 @@ exports.GH_GRAPHQL_URL = 'https://api.github.com'; const logger_1 = __nccwpck_require__(68809); const manifest_1 = __nccwpck_require__(31999); const signoff_commit_message_1 = __nccwpck_require__(2686); -const file_cache_1 = __nccwpck_require__(9405); +const git_file_utils_1 = __nccwpck_require__(32997); class GitHub { constructor(options) { + var _a; /** * Get the list of file paths modified in a given commit. * @@ -80247,7 +81841,7 @@ class GitHub { * @throws {GitHubAPIError} on an API error */ this.getCommitFiles = wrapAsync(async (sha) => { - logger_1.logger.debug(`Backfilling file list for commit: ${sha}`); + this.logger.debug(`Backfilling file list for commit: ${sha}`); const files = []; for await (const resp of this.octokit.paginate.iterator(this.octokit.repos.getCommit, { owner: this.repository.owner, @@ -80261,10 +81855,10 @@ class GitHub { } } if (files.length >= 3000) { - logger_1.logger.warn(`Found ${files.length} files. This may not include all the files.`); + this.logger.warn(`Found ${files.length} files. This may not include all the files.`); } else { - logger_1.logger.debug(`Found ${files.length} files`); + this.logger.debug(`Found ${files.length} files`); } return files; }); @@ -80278,26 +81872,26 @@ class GitHub { if (response) { return response; } - logger_1.logger.trace('no GraphQL response, retrying'); + this.logger.trace('no GraphQL response, retrying'); } catch (err) { if (err.status !== 502) { throw err; } if (maxRetries === 0) { - logger_1.logger.warn('ran out of retries and response is required'); + this.logger.warn('ran out of retries and response is required'); throw err; } - logger_1.logger.info(`received 502 error, ${maxRetries} attempts remaining`); + this.logger.info(`received 502 error, ${maxRetries} attempts remaining`); } maxRetries -= 1; if (maxRetries >= 0) { - logger_1.logger.trace(`sleeping ${seconds} seconds`); + this.logger.trace(`sleeping ${seconds} seconds`); await (0, exports.sleepInMs)(1000 * seconds); seconds = Math.min(seconds * 2, MAX_SLEEP_SECONDS); } } - logger_1.logger.trace('ran out of retries'); + this.logger.trace('ran out of retries'); return undefined; }); /** @@ -80315,31 +81909,26 @@ class GitHub { if (prefix) { prefix = normalizePrefix(prefix); } - logger_1.logger.debug(`finding files by filename: ${filename}, ref: ${ref}, prefix: ${prefix}`); - const response = await this.octokit.git.getTree({ - owner: this.repository.owner, - repo: this.repository.repo, - tree_sha: ref, - recursive: 'true', - }); - return response.data.tree - .filter(file => { - const path = file.path; - return (path && - // match the filename - path.endsWith(filename) && - // match the prefix if provided - (!prefix || path.startsWith(`${prefix}/`))); - }) - .map(file => { - let path = file.path; - // strip the prefix if provided - if (prefix) { - const pfix = new RegExp(`^${prefix}[/\\\\]`); - path = path.replace(pfix, ''); - } - return path; - }); + this.logger.debug(`finding files by filename: ${filename}, ref: ${ref}, prefix: ${prefix}`); + return await this.fileCache.findFilesByFilename(filename, ref, prefix); + }); + /** + * Returns a list of paths to all files matching a glob pattern. + * + * If a prefix is specified, only return paths that match + * the provided prefix. + * + * @param glob The glob to match + * @param ref Git reference to search files in + * @param prefix Optional path prefix used to filter results + * @throws {GitHubAPIError} on an API error + */ + this.findFilesByGlobAndRef = wrapAsync(async (glob, ref, prefix) => { + if (prefix) { + prefix = normalizePrefix(prefix); + } + this.logger.debug(`finding files by glob: ${glob}, ref: ${ref}, prefix: ${prefix}`); + return await this.fileCache.findFilesByGlob(glob, ref, prefix); }); this.createPullRequest = wrapAsync(async (pullRequest, targetBranch, message, updates, options) => { // Update the files for the release if not already supplied @@ -80354,7 +81943,7 @@ class GitHub { force: true, fork: !!(options === null || options === void 0 ? void 0 : options.fork), message, - logger: logger_1.logger, + logger: this.logger, draft: !!(options === null || options === void 0 ? void 0 : options.draft), labels: pullRequest.labels, }); @@ -80410,11 +81999,11 @@ class GitHub { force: true, fork: (options === null || options === void 0 ? void 0 : options.fork) === false ? false : true, message, - logger: logger_1.logger, + logger: this.logger, draft: releasePullRequest.draft, }); if (prNumber !== number) { - logger_1.logger.warn(`updated code for ${prNumber}, but update requested for ${number}`); + this.logger.warn(`updated code for ${prNumber}, but update requested for ${number}`); } const response = await this.octokit.pulls.update({ owner: this.repository.owner, @@ -80454,30 +82043,7 @@ class GitHub { if (prefix) { prefix = normalizePrefix(prefix); } - const response = await this.octokit.git.getTree({ - owner: this.repository.owner, - repo: this.repository.repo, - tree_sha: ref, - recursive: 'true', - }); - return response.data.tree - .filter(file => { - const path = file.path; - return (path && - // match the file extension - path.endsWith(`.${extension}`) && - // match the prefix if provided - (!prefix || path.startsWith(`${prefix}/`))); - }) - .map(file => { - let path = file.path; - // strip the prefix if provided - if (prefix) { - const pfix = new RegExp(`^${prefix}[/\\\\]`); - path = path.replace(pfix, ''); - } - return path; - }); + return this.fileCache.findFilesByExtension(extension, ref, prefix); }); /** * Create a GitHub release @@ -80528,7 +82094,7 @@ class GitHub { * @throws {GitHubAPIError} on an API error */ this.commentOnIssue = wrapAsync(async (comment, number) => { - logger_1.logger.debug(`adding comment to https://github.com/${this.repository.owner}/${this.repository.repo}/issue/${number}`); + this.logger.debug(`adding comment to https://github.com/${this.repository.owner}/${this.repository.repo}/issue/${number}`); const resp = await this.octokit.issues.createComment({ owner: this.repository.owner, repo: this.repository.repo, @@ -80547,7 +82113,7 @@ class GitHub { if (labels.length === 0) { return; } - logger_1.logger.debug(`removing labels: ${labels} from issue/pull ${number}`); + this.logger.debug(`removing labels: ${labels} from issue/pull ${number}`); await Promise.all(labels.map(label => this.octokit.issues.removeLabel({ owner: this.repository.owner, repo: this.repository.repo, @@ -80565,7 +82131,7 @@ class GitHub { if (labels.length === 0) { return; } - logger_1.logger.debug(`adding labels: ${labels} from issue/pull ${number}`); + this.logger.debug(`adding labels: ${labels} from issue/pull ${number}`); await this.octokit.issues.addLabels({ owner: this.repository.owner, repo: this.repository.repo, @@ -80577,7 +82143,8 @@ class GitHub { this.octokit = options.octokitAPIs.octokit; this.request = options.octokitAPIs.request; this.graphql = options.octokitAPIs.graphql; - this.fileCache = new file_cache_1.RepositoryFileCache(this.octokit, this.repository); + this.fileCache = new git_file_utils_1.RepositoryFileCache(this.octokit, this.repository); + this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : logger_1.logger; } /** * Build a new GitHub client with auto-detected default branch. @@ -80626,6 +82193,7 @@ class GitHub { defaultBranch: (_d = options.defaultBranch) !== null && _d !== void 0 ? _d : (await GitHub.defaultBranch(options.owner, options.repo, apis.octokit)), }, octokitAPIs: apis, + logger: options.logger, }; return new GitHub(opts); } @@ -80705,7 +82273,7 @@ class GitHub { } async mergeCommitsGraphQL(targetBranch, cursor, options = {}) { var _a, _b; - logger_1.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`); + this.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`); const query = `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) { repository(owner: $owner, name: $repo) { ref(qualifiedName: $targetBranch) { @@ -80765,12 +82333,12 @@ class GitHub { ...params, }); if (!response) { - logger_1.logger.warn(`Did not receive a response for query: ${query}`, params); + this.logger.warn(`Did not receive a response for query: ${query}`, params); return null; } // if the branch does exist, return null if (!((_a = response.repository) === null || _a === void 0 ? void 0 : _a.ref)) { - logger_1.logger.warn(`Could not find commits for branch ${targetBranch} - it likely does not exist.`); + this.logger.warn(`Could not find commits for branch ${targetBranch} - it likely does not exist.`); return null; } const history = response.repository.ref.target.history; @@ -80797,7 +82365,7 @@ class GitHub { files, }; if (((_b = pullRequest.files.pageInfo) === null || _b === void 0 ? void 0 : _b.hasNextPage) && options.backfillFiles) { - logger_1.logger.info(`PR #${pullRequest.number} has many files, backfilling`); + this.logger.info(`PR #${pullRequest.number} has many files, backfilling`); commit.files = await this.getCommitFiles(graphCommit.sha); } else { @@ -80823,12 +82391,32 @@ class GitHub { /** * Iterate through merged pull requests with a max number of results scanned. * - * @param {number} maxResults maxResults - Limit the number of results searched. - * Defaults to unlimited. + * @param {string} targetBranch The base branch of the pull request + * @param {string} status The status of the pull request + * @param {number} maxResults Limit the number of results searched. Defaults to + * unlimited. + * @param {boolean} includeFiles Whether to fetch the list of files included in + * the pull request. Defaults to `true`. * @yields {PullRequest} * @throws {GitHubAPIError} on an API error */ - async *pullRequestIterator(targetBranch, status = 'MERGED', maxResults = Number.MAX_SAFE_INTEGER) { + async *pullRequestIterator(targetBranch, status = 'MERGED', maxResults = Number.MAX_SAFE_INTEGER, includeFiles = true) { + const generator = includeFiles + ? this.pullRequestIteratorWithFiles(targetBranch, status, maxResults) + : this.pullRequestIteratorWithoutFiles(targetBranch, status, maxResults); + for await (const pullRequest of generator) { + yield pullRequest; + } + } + /** + * Helper implementation of pullRequestIterator that includes files via + * the graphQL API. + * + * @param {string} targetBranch The base branch of the pull request + * @param {string} status The status of the pull request + * @param {number} maxResults Limit the number of results searched + */ + async *pullRequestIteratorWithFiles(targetBranch, status = 'MERGED', maxResults = Number.MAX_SAFE_INTEGER) { let cursor = undefined; let results = 0; while (results < maxResults) { @@ -80847,6 +82435,52 @@ class GitHub { cursor = response.pageInfo.endCursor; } } + /** + * Helper implementation of pullRequestIterator that excludes files + * via the REST API. + * + * @param {string} targetBranch The base branch of the pull request + * @param {string} status The status of the pull request + * @param {number} maxResults Limit the number of results searched + */ + async *pullRequestIteratorWithoutFiles(targetBranch, status = 'MERGED', maxResults = Number.MAX_SAFE_INTEGER) { + const statusMap = { + OPEN: 'open', + CLOSED: 'closed', + MERGED: 'closed', + }; + let results = 0; + for await (const { data: pulls } of this.octokit.paginate.iterator(this.octokit.rest.pulls.list, { + state: statusMap[status], + owner: this.repository.owner, + repo: this.repository.repo, + base: targetBranch, + })) { + for (const pull of pulls) { + // The REST API does not have an option for "merged" + // pull requests - they are closed with a `merged_at` timestamp + if (status !== 'MERGED' || pull.merged_at) { + results += 1; + yield { + headBranchName: pull.head.ref, + baseBranchName: pull.base.ref, + number: pull.number, + title: pull.title, + body: pull.body || '', + labels: pull.labels.map(label => label.name), + files: [], + sha: pull.merge_commit_sha || undefined, + }; + if (results >= maxResults) { + break; + } + } + } + if (results >= maxResults) { + break; + } + } + } /** * Return a list of merged pull requests. The list is not guaranteed to be sorted * by merged_at, but is generally most recent first. @@ -80860,7 +82494,7 @@ class GitHub { */ async pullRequestsGraphQL(targetBranch, states = 'MERGED', cursor) { var _a; - logger_1.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`); + this.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`); const response = await this.graphqlRequest({ query: `query mergedPullRequests($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $states: [PullRequestState!], $cursor: String) { repository(owner: $owner, name: $repo) { @@ -80905,7 +82539,7 @@ class GitHub { maxFilesChanged: 64, }); if (!((_a = response === null || response === void 0 ? void 0 : response.repository) === null || _a === void 0 ? void 0 : _a.pullRequests)) { - logger_1.logger.warn(`Could not find merged pull requests for branch ${targetBranch} - it likely does not exist.`); + this.logger.warn(`Could not find merged pull requests for branch ${targetBranch} - it likely does not exist.`); return null; } const pullRequests = (response.repository.pullRequests.nodes || @@ -80959,7 +82593,7 @@ class GitHub { } } async releaseGraphQL(cursor) { - logger_1.logger.debug(`Fetching releases with cursor ${cursor}`); + this.logger.debug(`Fetching releases with cursor ${cursor}`); const response = await this.graphqlRequest({ query: `query releases($owner: String!, $repo: String!, $num: Int!, $cursor: String) { repository(owner: $owner, name: $repo) { @@ -80989,7 +82623,7 @@ class GitHub { num: 25, }); if (!response.repository.releases.nodes.length) { - logger_1.logger.warn('Could not find releases.'); + this.logger.warn('Could not find releases.'); return null; } const releases = response.repository.releases.nodes; @@ -80999,7 +82633,7 @@ class GitHub { .filter(release => !!release.tagCommit) .map(release => { if (!release.tag || !release.tagCommit) { - logger_1.logger.debug(release); + this.logger.debug(release); } return { name: release.name || undefined, @@ -81060,8 +82694,16 @@ class GitHub { * @throws {GitHubAPIError} on other API errors */ async getFileContentsOnBranch(path, branch) { - logger_1.logger.debug(`Fetching ${path} from branch ${branch}`); - return await this.fileCache.getFileContents(path, branch); + this.logger.debug(`Fetching ${path} from branch ${branch}`); + try { + return await this.fileCache.getFileContents(path, branch); + } + catch (e) { + if (e instanceof git_file_utils_1.FileNotFoundError) { + throw new errors_1.FileNotFoundError(path); + } + throw e; + } } async getFileJson(path, branch) { const content = await this.getFileContentsOnBranch(path, branch); @@ -81081,6 +82723,20 @@ class GitHub { async findFilesByFilename(filename, prefix) { return this.findFilesByFilenameAndRef(filename, this.repository.defaultBranch, prefix); } + /** + * Returns a list of paths to all files matching a glob pattern. + * + * If a prefix is specified, only return paths that match + * the provided prefix. + * + * @param glob The glob to match + * @param prefix Optional path prefix used to filter results + * @returns {string[]} List of file paths + * @throws {GitHubAPIError} on an API error + */ + async findFilesByGlob(glob, prefix) { + return this.findFilesByGlobAndRef(glob, this.repository.defaultBranch, prefix); + } /** * Open a pull request * @@ -81131,19 +82787,19 @@ class GitHub { // if the file is missing and create = false, just continue // to the next update, otherwise create the file. if (!update.createIfMissing) { - logger_1.logger.warn(`file ${update.path} did not exist`); + this.logger.warn(`file ${update.path} did not exist`); continue; } } const contentText = content ? Buffer.from(content.content, 'base64').toString('utf8') : undefined; - const updatedContent = update.updater.updateContent(contentText); + const updatedContent = update.updater.updateContent(contentText, this.logger); if (updatedContent) { changes.set(update.path, { content: updatedContent, originalContent: (content === null || content === void 0 ? void 0 : content.parsedContent) || null, - mode: (content === null || content === void 0 ? void 0 : content.mode) || file_cache_1.DEFAULT_FILE_MODE, + mode: (content === null || content === void 0 ? void 0 : content.mode) || git_file_utils_1.DEFAULT_FILE_MODE, }); } } @@ -81294,7 +82950,7 @@ class Manifest { * pull request. Defaults to `[autorelease: tagged]` */ constructor(github, targetBranch, repositoryConfig, releasedVersions, manifestOptions) { - var _a; + var _a, _b; this.repository = github.repository; this.github = github; this.targetBranch = targetBranch; @@ -81324,6 +82980,7 @@ class Manifest { (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.releaseSearchDepth) || DEFAULT_RELEASE_SEARCH_DEPTH; this.commitSearchDepth = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.commitSearchDepth) || DEFAULT_COMMIT_SEARCH_DEPTH; + this.logger = (_b = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.logger) !== null && _b !== void 0 ? _b : logger_1.logger; } /** * Create a Manifest from config files in the repository. @@ -81380,7 +83037,7 @@ class Manifest { }); const component = await strategy.getBranchComponent(); const releasedVersions = {}; - const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), config, component); + const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), config, component, manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.logger); if (latestVersion) { releasedVersions[path] = latestVersion; } @@ -81399,39 +83056,39 @@ class Manifest { */ async buildPullRequests() { var _a; - logger_1.logger.info('Building pull requests'); + this.logger.info('Building pull requests'); const pathsByComponent = await this.getPathsByComponent(); const strategiesByPath = await this.getStrategiesByPath(); // Collect all the SHAs of the latest release packages - logger_1.logger.info('Collecting release commit SHAs'); + this.logger.info('Collecting release commit SHAs'); let releasesFound = 0; const expectedReleases = Object.keys(strategiesByPath).length; // SHAs by path const releaseShasByPath = {}; // Releases by path const releasesByPath = {}; - logger_1.logger.debug(`release search depth: ${this.releaseSearchDepth}`); + this.logger.debug(`release search depth: ${this.releaseSearchDepth}`); for await (const release of this.github.releaseIterator({ maxResults: this.releaseSearchDepth, })) { const tagName = tag_name_1.TagName.parse(release.tagName); if (!tagName) { - logger_1.logger.warn(`Unable to parse release name: ${release.name}`); + this.logger.warn(`Unable to parse release name: ${release.name}`); continue; } const component = tagName.component || exports.DEFAULT_COMPONENT_NAME; const path = pathsByComponent[component]; if (!path) { - logger_1.logger.warn(`Found release tag with component '${component}', but not configured in manifest`); + this.logger.warn(`Found release tag with component '${component}', but not configured in manifest`); continue; } const expectedVersion = this.releasedVersions[path]; if (!expectedVersion) { - logger_1.logger.warn(`Unable to find expected version for path '${path}' in manifest`); + this.logger.warn(`Unable to find expected version for path '${path}' in manifest`); continue; } if (expectedVersion.toString() === tagName.version.toString()) { - logger_1.logger.debug(`Found release for path ${path}, ${release.tagName}`); + this.logger.debug(`Found release for path ${path}, ${release.tagName}`); releaseShasByPath[path] = release.sha; releasesByPath[path] = { name: release.name, @@ -81447,10 +83104,10 @@ class Manifest { } const needsBootstrap = releasesFound < expectedReleases; if (releasesFound < expectedReleases) { - logger_1.logger.warn(`Expected ${expectedReleases} releases, only found ${releasesFound}`); + this.logger.warn(`Expected ${expectedReleases} releases, only found ${releasesFound}`); // Fall back to looking for missing releases using expected tags const missingPaths = Object.keys(strategiesByPath).filter(path => !releasesByPath[path]); - logger_1.logger.warn(`Missing ${missingPaths.length} paths: ${missingPaths}`); + this.logger.warn(`Missing ${missingPaths.length} paths: ${missingPaths}`); const missingReleases = await this.backfillReleasesFromTags(missingPaths, strategiesByPath); for (const path in missingReleases) { releaseShasByPath[path] = missingReleases[path].sha; @@ -81459,23 +83116,23 @@ class Manifest { } } if (releasesFound < expectedReleases) { - logger_1.logger.warn(`Expected ${expectedReleases} releases, only found ${releasesFound}`); + this.logger.warn(`Expected ${expectedReleases} releases, only found ${releasesFound}`); } for (const path in releasesByPath) { const release = releasesByPath[path]; - logger_1.logger.debug(`release for path: ${path}, version: ${release.tag.version.toString()}, sha: ${release.sha}`); + this.logger.debug(`release for path: ${path}, version: ${release.tag.version.toString()}, sha: ${release.sha}`); } // iterate through commits and collect commits until we have // seen all release commits - logger_1.logger.info('Collecting commits since all latest releases'); + this.logger.info('Collecting commits since all latest releases'); const commits = []; - logger_1.logger.debug(`commit search depth: ${this.commitSearchDepth}`); + this.logger.debug(`commit search depth: ${this.commitSearchDepth}`); const commitGenerator = this.github.mergeCommitIterator(this.targetBranch, { maxResults: this.commitSearchDepth, backfillFiles: true, }); const releaseShas = new Set(Object.values(releaseShasByPath)); - logger_1.logger.debug(releaseShas); + this.logger.debug(releaseShas); const expectedShas = releaseShas.size; // sha => release pull request const releasePullRequestsBySha = {}; @@ -81486,16 +83143,16 @@ class Manifest { releasePullRequestsBySha[commit.sha] = commit.pullRequest; } else { - logger_1.logger.warn(`Release SHA ${commit.sha} did not have an associated pull request`); + this.logger.warn(`Release SHA ${commit.sha} did not have an associated pull request`); } releaseCommitsFound += 1; } if (this.lastReleaseSha && this.lastReleaseSha === commit.sha) { - logger_1.logger.info(`Using configured lastReleaseSha ${this.lastReleaseSha} as last commit.`); + this.logger.info(`Using configured lastReleaseSha ${this.lastReleaseSha} as last commit.`); break; } else if (needsBootstrap && commit.sha === this.bootstrapSha) { - logger_1.logger.info(`Needed bootstrapping, found configured bootstrapSha ${this.bootstrapSha}`); + this.logger.info(`Needed bootstrapping, found configured bootstrapSha ${this.bootstrapSha}`); break; } else if (!needsBootstrap && releaseCommitsFound >= expectedShas) { @@ -81510,10 +83167,10 @@ class Manifest { }); } if (releaseCommitsFound < expectedShas) { - logger_1.logger.warn(`Expected ${expectedShas} commits, only found ${releaseCommitsFound}`); + this.logger.warn(`Expected ${expectedShas} commits, only found ${releaseCommitsFound}`); } // split commits by path - logger_1.logger.info(`Splitting ${commits.length} commits by path`); + this.logger.info(`Splitting ${commits.length} commits by path`); const cs = new commit_split_1.CommitSplit({ includeEmpty: true, packagePaths: Object.keys(this.repositoryConfig), @@ -81533,7 +83190,7 @@ class Manifest { const version = this.releasedVersions[path]; const strategy = strategiesByPath[path]; const component = await strategy.getComponent(); - logger_1.logger.info(`No latest release found for path: ${path}, component: ${component}, but a previous version (${version.toString()}) was specified in the manifest.`); + this.logger.info(`No latest release found for path: ${path}, component: ${component}, but a previous version (${version.toString()}) was specified in the manifest.`); releasesByPath[path] = { tag: new tag_name_1.TagName(version, component), sha: '', @@ -81556,14 +83213,20 @@ class Manifest { let newReleasePullRequests = []; for (const path in this.repositoryConfig) { const config = this.repositoryConfig[path]; - logger_1.logger.info(`Building candidate release pull request for path: ${path}`); - logger_1.logger.debug(`type: ${config.releaseType}`); - logger_1.logger.debug(`targetBranch: ${this.targetBranch}`); - const pathCommits = commitsPerPath[path]; - logger_1.logger.debug(`commits: ${pathCommits.length}`); + this.logger.info(`Building candidate release pull request for path: ${path}`); + this.logger.debug(`type: ${config.releaseType}`); + this.logger.debug(`targetBranch: ${this.targetBranch}`); + let pathCommits = commitsPerPath[path]; + // The processCommits hook can be implemented by plugins to + // post-process commits. This can be used to perform cleanup, e.g,, sentence + // casing all commit messages: + for (const plugin of plugins) { + pathCommits = plugin.processCommits(pathCommits); + } + this.logger.debug(`commits: ${pathCommits.length}`); const latestReleasePullRequest = releasePullRequestsBySha[releaseShasByPath[path]]; if (!latestReleasePullRequest) { - logger_1.logger.warn('No latest release pull request found.'); + this.logger.warn('No latest release pull request found.'); } const strategy = strategies[path]; const latestRelease = releasesByPath[path]; @@ -81596,7 +83259,7 @@ class Manifest { plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, this.groupPullRequestTitlePattern)); } for (const plugin of plugins) { - logger_1.logger.debug(`running plugin: ${plugin.constructor.name}`); + this.logger.debug(`running plugin: ${plugin.constructor.name}`); newReleasePullRequests = await plugin.run(newReleasePullRequests); } return newReleasePullRequests.map(pullRequestWithConfig => pullRequestWithConfig.pullRequest); @@ -81607,15 +83270,15 @@ class Manifest { for (const path of missingPaths) { const expectedVersion = this.releasedVersions[path]; if (!expectedVersion) { - logger_1.logger.warn(`No version for path ${path}`); + this.logger.warn(`No version for path ${path}`); continue; } const component = await strategiesByPath[path].getComponent(); const expectedTag = new tag_name_1.TagName(expectedVersion, component, this.repositoryConfig[path].tagSeparator, this.repositoryConfig[path].includeVInTag); - logger_1.logger.debug(`looking for tagName: ${expectedTag.toString()}`); + this.logger.debug(`looking for tagName: ${expectedTag.toString()}`); const foundTag = allTags[expectedTag.toString()]; if (foundTag) { - logger_1.logger.debug(`found: ${foundTag.name} ${foundTag.sha}`); + this.logger.debug(`found: ${foundTag.name} ${foundTag.sha}`); releasesByPath[path] = { name: foundTag.name, tag: expectedTag, @@ -81647,7 +83310,7 @@ class Manifest { // any new release PRs const mergedPullRequestsGenerator = this.findMergedReleasePullRequests(); for await (const _ of mergedPullRequestsGenerator) { - logger_1.logger.warn('There are untagged, merged release PRs outstanding - aborting'); + this.logger.warn('There are untagged, merged release PRs outstanding - aborting'); return []; } // collect open and snoozed release pull requests @@ -81673,32 +83336,32 @@ class Manifest { } } async findOpenReleasePullRequests() { - logger_1.logger.info('Looking for open release pull requests'); + this.logger.info('Looking for open release pull requests'); const openPullRequests = []; - const generator = this.github.pullRequestIterator(this.targetBranch, 'OPEN'); + const generator = this.github.pullRequestIterator(this.targetBranch, 'OPEN', Number.MAX_SAFE_INTEGER, false); for await (const openPullRequest of generator) { if ((hasAllLabels(this.labels, openPullRequest.labels) || hasAllLabels(this.snapshotLabels, openPullRequest.labels)) && - branch_name_1.BranchName.parse(openPullRequest.headBranchName) && - pull_request_body_1.PullRequestBody.parse(openPullRequest.body)) { + branch_name_1.BranchName.parse(openPullRequest.headBranchName, this.logger) && + pull_request_body_1.PullRequestBody.parse(openPullRequest.body, this.logger)) { openPullRequests.push(openPullRequest); } } - logger_1.logger.info(`found ${openPullRequests.length} open release pull requests.`); + this.logger.info(`found ${openPullRequests.length} open release pull requests.`); return openPullRequests; } async findSnoozedReleasePullRequests() { - logger_1.logger.info('Looking for snoozed release pull requests'); + this.logger.info('Looking for snoozed release pull requests'); const snoozedPullRequests = []; - const closedGenerator = this.github.pullRequestIterator(this.targetBranch, 'CLOSED'); + const closedGenerator = this.github.pullRequestIterator(this.targetBranch, 'CLOSED', 200, false); for await (const closedPullRequest of closedGenerator) { if (hasAllLabels([exports.SNOOZE_LABEL], closedPullRequest.labels) && - branch_name_1.BranchName.parse(closedPullRequest.headBranchName) && - pull_request_body_1.PullRequestBody.parse(closedPullRequest.body)) { + branch_name_1.BranchName.parse(closedPullRequest.headBranchName, this.logger) && + pull_request_body_1.PullRequestBody.parse(closedPullRequest.body, this.logger)) { snoozedPullRequests.push(closedPullRequest); } } - logger_1.logger.info(`found ${snoozedPullRequests.length} snoozed release pull requests.`); + this.logger.info(`found ${snoozedPullRequests.length} snoozed release pull requests.`); return snoozedPullRequests; } async createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests) { @@ -81723,7 +83386,7 @@ class Manifest { async maybeUpdateExistingPullRequest(existing, pullRequest) { // If unchanged, no need to push updates if (existing.body === pullRequest.body.toString()) { - logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${existing.number} remained the same`); + this.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${existing.number} remained the same`); return undefined; } const updatedPullRequest = await this.github.updatePullRequest(existing.number, pullRequest, this.targetBranch, { @@ -81736,7 +83399,7 @@ class Manifest { async maybeUpdateSnoozedPullRequest(snoozed, pullRequest) { // If unchanged, no need to push updates if (snoozed.body === pullRequest.body.toString()) { - logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${snoozed.number} remained the same`); + this.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${snoozed.number} remained the same`); return undefined; } const updatedPullRequest = await this.github.updatePullRequest(snoozed.number, pullRequest, this.targetBranch, { @@ -81749,15 +83412,15 @@ class Manifest { } async *findMergedReleasePullRequests() { // Find merged release pull requests - const pullRequestGenerator = this.github.pullRequestIterator(this.targetBranch, 'MERGED', 200); + const pullRequestGenerator = this.github.pullRequestIterator(this.targetBranch, 'MERGED', 200, false); for await (const pullRequest of pullRequestGenerator) { if (!hasAllLabels(this.labels, pullRequest.labels)) { continue; } - logger_1.logger.debug(`Found pull request #${pullRequest.number}: '${pullRequest.title}'`); - const pullRequestBody = pull_request_body_1.PullRequestBody.parse(pullRequest.body); + this.logger.debug(`Found pull request #${pullRequest.number}: '${pullRequest.title}'`); + const pullRequestBody = pull_request_body_1.PullRequestBody.parse(pullRequest.body, this.logger); if (!pullRequestBody) { - logger_1.logger.debug('could not parse pull request body as a release PR'); + this.logger.debug('could not parse pull request body as a release PR'); continue; } yield pullRequest; @@ -81770,7 +83433,7 @@ class Manifest { */ async buildReleases() { var _a; - logger_1.logger.info('Building releases'); + this.logger.info('Building releases'); const strategiesByPath = await this.getStrategiesByPath(); // Find merged release pull requests const generator = await this.findMergedReleasePullRequests(); @@ -81778,9 +83441,9 @@ class Manifest { for await (const pullRequest of generator) { for (const path in this.repositoryConfig) { const config = this.repositoryConfig[path]; - logger_1.logger.info(`Building release for path: ${path}`); - logger_1.logger.debug(`type: ${config.releaseType}`); - logger_1.logger.debug(`targetBranch: ${this.targetBranch}`); + this.logger.info(`Building release for path: ${path}`); + this.logger.debug(`type: ${config.releaseType}`); + this.logger.debug(`targetBranch: ${this.targetBranch}`); const strategy = strategiesByPath[path]; const release = await strategy.buildRelease(pullRequest); if (release) { @@ -81795,7 +83458,7 @@ class Manifest { }); } else { - logger_1.logger.info(`No release necessary for path: ${path}`); + this.logger.info(`No release necessary for path: ${path}`); } } } @@ -81838,7 +83501,7 @@ class Manifest { } } async createReleasesForPullRequest(releases, pullRequest) { - logger_1.logger.info(`Creating ${releases.length} releases for pull #${pullRequest.number}`); + this.logger.info(`Creating ${releases.length} releases for pull #${pullRequest.number}`); const duplicateReleases = []; const githubReleases = []; for (const release of releases) { @@ -81847,7 +83510,7 @@ class Manifest { } catch (err) { if (err instanceof errors_1.DuplicateReleaseError) { - logger_1.logger.warn(`Duplicate release tag: ${release.tag.toString()}`); + this.logger.warn(`Duplicate release tag: ${release.tag.toString()}`); duplicateReleases.push(err); } else { @@ -81898,11 +83561,11 @@ class Manifest { } async getStrategiesByPath() { if (!this._strategiesByPath) { - logger_1.logger.info('Building strategies by path'); + this.logger.info('Building strategies by path'); this._strategiesByPath = {}; for (const path in this.repositoryConfig) { const config = this.repositoryConfig[path]; - logger_1.logger.debug(`${path}: ${config.releaseType}`); + this.logger.debug(`${path}: ${config.releaseType}`); const strategy = await (0, factory_1.buildStrategy)({ ...config, github: this.github, @@ -81922,7 +83585,7 @@ class Manifest { const strategy = strategiesByPath[path]; const component = (await strategy.getComponent()) || ''; if (this._pathsByComponent[component]) { - logger_1.logger.warn(`Multiple paths for ${component}: ${this._pathsByComponent[component]}, ${path}`); + this.logger.warn(`Multiple paths for ${component}: ${this._pathsByComponent[component]}, ${path}`); } this._pathsByComponent[component] = path; } @@ -81961,6 +83624,7 @@ function extractReleaserConfig(config) { includeVInTag: config['include-v-in-tag'], changelogType: config['changelog-type'], pullRequestTitlePattern: config['pull-request-title-pattern'], + pullRequestHeader: config['pull-request-header'], tagSeparator: config['tag-separator'], separatePullRequests: config['separate-pull-requests'], labels: (_a = config['label']) === null || _a === void 0 ? void 0 : _a.split(','), @@ -82085,13 +83749,13 @@ function isPublishedVersion(strategy, version) { * @param {string} prefix Limit the release to a specific component. * @param pullRequestTitlePattern Configured PR title pattern. */ -async function latestReleaseVersion(github, targetBranch, releaseFilter, config, prefix) { +async function latestReleaseVersion(github, targetBranch, releaseFilter, config, prefix, logger = logger_1.logger) { const branchPrefix = prefix ? prefix.endsWith('-') ? prefix.replace(/-$/, '') : prefix : undefined; - logger_1.logger.info(`Looking for latest release on branch: ${targetBranch} with prefix: ${prefix}`); + logger.info(`Looking for latest release on branch: ${targetBranch} with prefix: ${prefix}`); // collect set of recent commit SHAs seen to verify that the release // is in the current branch const commitShas = new Set(); @@ -82108,7 +83772,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config, if (!mergedPullRequest) { continue; } - const branchName = branch_name_1.BranchName.parse(mergedPullRequest.headBranchName); + const branchName = branch_name_1.BranchName.parse(mergedPullRequest.headBranchName, logger); if (!branchName) { continue; } @@ -82117,13 +83781,13 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config, if (branchName.getComponent() !== branchPrefix) { continue; } - const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, config.pullRequestTitlePattern); + const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, config.pullRequestTitlePattern, logger); if (!pullRequestTitle) { continue; } const version = pullRequestTitle.getVersion(); if (version && releaseFilter(version)) { - logger_1.logger.debug(`Found latest release pull request: ${mergedPullRequest.number} version: ${version}`); + logger.debug(`Found latest release pull request: ${mergedPullRequest.number} version: ${version}`); candidateReleaseVersions.push(version); break; } @@ -82137,15 +83801,15 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config, continue; } if (tagMatchesConfig(tagName, branchPrefix, config.includeComponentInTag)) { - logger_1.logger.debug(`found release for ${prefix}`, tagName.version); + logger.debug(`found release for ${prefix}`, tagName.version); if (!commitShas.has(release.sha)) { - logger_1.logger.debug(`SHA not found in recent commits to branch ${targetBranch}, skipping`); + logger.debug(`SHA not found in recent commits to branch ${targetBranch}, skipping`); continue; } candidateReleaseVersions.push(tagName.version); } } - logger_1.logger.debug(`found ${candidateReleaseVersions.length} possible releases.`, candidateReleaseVersions); + logger.debug(`found ${candidateReleaseVersions.length} possible releases.`, candidateReleaseVersions); if (candidateReleaseVersions.length > 0) { // Find largest release number (sort descending then return first) return candidateReleaseVersions.sort((a, b) => b.compare(a))[0]; @@ -82161,18 +83825,18 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config, } if (tagMatchesConfig(tagName, branchPrefix, config.includeComponentInTag)) { if (!commitShas.has(tag.sha)) { - logger_1.logger.debug(`SHA not found in recent commits to branch ${targetBranch}, skipping`); + logger.debug(`SHA not found in recent commits to branch ${targetBranch}, skipping`); continue; } candidateTagVersion.push(tagName.version); } } - logger_1.logger.debug(`found ${candidateTagVersion.length} possible tags.`, candidateTagVersion); + logger.debug(`found ${candidateTagVersion.length} possible tags.`, candidateTagVersion); // Find largest release number (sort descending then return first) return candidateTagVersion.sort((a, b) => b.compare(a))[0]; } function mergeReleaserConfig(defaultConfig, pathConfig) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z; return { releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node', bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor, @@ -82194,8 +83858,9 @@ function mergeReleaserConfig(defaultConfig, pathConfig) { includeVInTag: (_u = pathConfig.includeVInTag) !== null && _u !== void 0 ? _u : defaultConfig.includeVInTag, tagSeparator: (_v = pathConfig.tagSeparator) !== null && _v !== void 0 ? _v : defaultConfig.tagSeparator, pullRequestTitlePattern: (_w = pathConfig.pullRequestTitlePattern) !== null && _w !== void 0 ? _w : defaultConfig.pullRequestTitlePattern, - separatePullRequests: (_x = pathConfig.separatePullRequests) !== null && _x !== void 0 ? _x : defaultConfig.separatePullRequests, - skipSnapshot: (_y = pathConfig.skipSnapshot) !== null && _y !== void 0 ? _y : defaultConfig.skipSnapshot, + pullRequestHeader: (_x = pathConfig.pullRequestHeader) !== null && _x !== void 0 ? _x : defaultConfig.pullRequestHeader, + separatePullRequests: (_y = pathConfig.separatePullRequests) !== null && _y !== void 0 ? _y : defaultConfig.separatePullRequests, + skipSnapshot: (_z = pathConfig.skipSnapshot) !== null && _z !== void 0 ? _z : defaultConfig.skipSnapshot, }; } /** @@ -82236,7 +83901,7 @@ function tagMatchesConfig(tag, branchComponent, includeComponentInTag) { /***/ }), /***/ 31651: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -82255,6 +83920,7 @@ function tagMatchesConfig(tag, branchComponent, includeComponentInTag) { // limitations under the License. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ManifestPlugin = void 0; +const logger_1 = __nccwpck_require__(68809); /** * A plugin runs after a repository manifest has built candidate * pull requests and can make updates that span across multiple @@ -82262,10 +83928,21 @@ exports.ManifestPlugin = void 0; * or update existing files. */ class ManifestPlugin { - constructor(github, targetBranch, repositoryConfig) { + constructor(github, targetBranch, repositoryConfig, logger = logger_1.logger) { this.github = github; this.targetBranch = targetBranch; this.repositoryConfig = repositoryConfig; + this.logger = logger; + } + /** + * Perform post-processing on commits, e.g, sentence casing them. + * @param {Commit[]} commits The set of commits that will feed into release pull request. + * @returns {Commit[]} The modified commit objects. + */ + // TODO: for next major version, let's run the default conventional commit parser earlier + // (outside of the strategy classes) and pass in the ConventionalCommit[] objects in. + processCommits(commits) { + return commits; } /** * Post-process candidate pull requests. @@ -82310,7 +83987,6 @@ exports.ManifestPlugin = ManifestPlugin; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CargoWorkspace = void 0; const manifest_1 = __nccwpck_require__(31999); -const logger_1 = __nccwpck_require__(68809); const workspace_1 = __nccwpck_require__(44226); const common_1 = __nccwpck_require__(11659); const version_1 = __nccwpck_require__(17348); @@ -82335,7 +84011,7 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { const cargoManifestContent = await this.github.getFileContentsOnBranch('Cargo.toml', this.targetBranch); const cargoManifest = (0, common_1.parseCargoManifest)(cargoManifestContent.parsedContent); if (!((_a = cargoManifest.workspace) === null || _a === void 0 ? void 0 : _a.members)) { - logger_1.logger.warn("cargo-workspace plugin used, but top-level Cargo.toml isn't a cargo workspace"); + this.logger.warn("cargo-workspace plugin used, but top-level Cargo.toml isn't a cargo workspace"); return { allPackages: [], candidatesByPackage: {} }; } const allCrates = []; @@ -82344,7 +84020,7 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { members.push(manifest_1.ROOT_PROJECT_PATH); for (const path of members) { const manifestPath = (0, workspace_1.addPath)(path, 'Cargo.toml'); - logger_1.logger.info(`looking for candidate with path: ${path}`); + this.logger.info(`looking for candidate with path: ${path}`); const candidate = candidates.find(c => c.path === path); // get original content of the crate const manifestContent = ((_b = candidate === null || candidate === void 0 ? void 0 : candidate.pullRequest.updates.find(update => update.path === manifestPath)) === null || _b === void 0 ? void 0 : _b.cachedFileContents) || @@ -82352,7 +84028,7 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { const manifest = (0, common_1.parseCargoManifest)(manifestContent.parsedContent); const packageName = (_c = manifest.package) === null || _c === void 0 ? void 0 : _c.name; if (!packageName) { - logger_1.logger.warn(`package manifest at ${manifestPath} is missing [package.name]`); + this.logger.warn(`package manifest at ${manifestPath} is missing [package.name]`); continue; } if (candidate) { @@ -82399,7 +84075,7 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { update.updater = new raw_content_1.RawContent(updatedContent); } else if (update.updater instanceof changelog_1.Changelog && dependencyNotes) { - update.updater.changelogEntry = (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes); + update.updater.changelogEntry = (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes, this.logger); } else if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'Cargo.lock')) { update.updater = new cargo_lock_1.CargoLock(updatedVersions); @@ -82410,13 +84086,13 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { if (dependencyNotes) { if (existingCandidate.pullRequest.body.releaseData.length > 0) { existingCandidate.pullRequest.body.releaseData[0].notes = - (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes); + (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes, this.logger); } else { existingCandidate.pullRequest.body.releaseData.push({ component: pkg.name, version: existingCandidate.pullRequest.version, - notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes), + notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger), }); } } @@ -82441,7 +84117,7 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { { component: pkg.name, version, - notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes), + notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger), }, ]), updates: [ @@ -82475,11 +84151,11 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin { postProcessCandidates(candidates, updatedVersions) { let rootCandidate = candidates.find(c => c.path === manifest_1.ROOT_PROJECT_PATH); if (!rootCandidate) { - logger_1.logger.warn('Unable to find root candidate pull request'); + this.logger.warn('Unable to find root candidate pull request'); rootCandidate = candidates.find(c => c.config.releaseType === 'rust'); } if (!rootCandidate) { - logger_1.logger.warn('Unable to find a rust candidate pull request'); + this.logger.warn('Unable to find a rust candidate pull request'); return candidates; } // Update the root Cargo.lock if it exists @@ -82601,7 +84277,6 @@ function getChangelogDepsNotes(originalManifest, updatedManifest) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LinkedVersions = void 0; const plugin_1 = __nccwpck_require__(31651); -const logger_1 = __nccwpck_require__(68809); const factory_1 = __nccwpck_require__(75695); const merge_1 = __nccwpck_require__(90514); /** @@ -82613,7 +84288,7 @@ const merge_1 = __nccwpck_require__(90514); class LinkedVersions extends plugin_1.ManifestPlugin { constructor(github, targetBranch, repositoryConfig, groupName, components, options = {}) { var _a; - super(github, targetBranch, repositoryConfig); + super(github, targetBranch, repositoryConfig, options.logger); this.groupName = groupName; this.components = new Set(components); this.merge = (_a = options.merge) !== null && _a !== void 0 ? _a : true; @@ -82636,7 +84311,7 @@ class LinkedVersions extends plugin_1.ManifestPlugin { groupStrategies[path] = strategy; } } - logger_1.logger.info(`Found ${Object.keys(groupStrategies).length} group components for ${this.groupName}`); + this.logger.info(`Found ${Object.keys(groupStrategies).length} group components for ${this.groupName}`); const groupVersions = {}; const missingReleasePaths = new Set(); for (const path in groupStrategies) { @@ -82659,7 +84334,7 @@ class LinkedVersions extends plugin_1.ManifestPlugin { for (const path in strategiesByPath) { if (path in groupStrategies) { const component = await strategiesByPath[path].getComponent(); - logger_1.logger.info(`Replacing strategy for path ${path} with forced version: ${primaryVersion}`); + this.logger.info(`Replacing strategy for path ${path} with forced version: ${primaryVersion}`); newStrategies[path] = await (0, factory_1.buildStrategy)({ ...this.repositoryConfig[path], github: this.github, @@ -82668,7 +84343,7 @@ class LinkedVersions extends plugin_1.ManifestPlugin { releaseAs: primaryVersion.toString(), }); if (missingReleasePaths.has(path)) { - logger_1.logger.debug(`Appending fake commit for path: ${path}`); + this.logger.debug(`Appending fake commit for path: ${path}`); commitsByPath[path].push({ sha: '', message: `chore(${component}): Synchronize ${this.groupName} versions\n\nRelease-As: ${primaryVersion.toString()}`, @@ -82692,7 +84367,7 @@ class LinkedVersions extends plugin_1.ManifestPlugin { } const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => { if (!candidate.pullRequest.version) { - logger_1.logger.warn('pull request missing version', candidate); + this.logger.warn('pull request missing version', candidate); return collection; } if (this.components.has(candidate.config.component || '')) { @@ -82742,13 +84417,13 @@ const version_1 = __nccwpck_require__(17348); const versioning_strategy_1 = __nccwpck_require__(41941); const dom = __nccwpck_require__(49213); const xpath = __nccwpck_require__(65319); -const logger_1 = __nccwpck_require__(68809); const path_1 = __nccwpck_require__(85622); const pom_xml_1 = __nccwpck_require__(60255); const changelog_1 = __nccwpck_require__(3325); const pull_request_title_1 = __nccwpck_require__(1158); const pull_request_body_1 = __nccwpck_require__(70774); const branch_name_1 = __nccwpck_require__(16344); +const logger_1 = __nccwpck_require__(68809); const JAVA_RELEASE_TYPES = new Set(['java', 'java-bom', 'java-yoshi', 'maven']); const XPATH_PROJECT_GROUP = '/*[local-name()="project"]/*[local-name()="groupId"]'; const XPATH_PROJECT_ARTIFACT = '/*[local-name()="project"]/*[local-name()="artifactId"]'; @@ -82760,17 +84435,17 @@ class MavenWorkspace extends workspace_1.WorkspacePlugin { const document = new dom.DOMParser().parseFromString(content.parsedContent); const groupNodes = xpath.select(XPATH_PROJECT_GROUP, document); if (groupNodes.length === 0) { - logger_1.logger.warn(`Missing project.groupId in ${path}`); + this.logger.warn(`Missing project.groupId in ${path}`); return; } const artifactNodes = xpath.select(XPATH_PROJECT_ARTIFACT, document); if (artifactNodes.length === 0) { - logger_1.logger.warn(`Missing project.artifactId in ${path}`); + this.logger.warn(`Missing project.artifactId in ${path}`); return; } const versionNodes = xpath.select(XPATH_PROJECT_VERSION, document); if (versionNodes.length === 0) { - logger_1.logger.warn(`Missing project.version in ${path}`); + this.logger.warn(`Missing project.version in ${path}`); return; } const dependencies = []; @@ -82817,7 +84492,7 @@ class MavenWorkspace extends workspace_1.WorkspacePlugin { const path = (0, path_1.dirname)(pomFile); const config = this.repositoryConfig[path]; if (!config) { - logger_1.logger.info(`path '${path}' not configured, ignoring '${pomFile}'`); + this.logger.info(`path '${path}' not configured, ignoring '${pomFile}'`); continue; } const mavenArtifact = await this.fetchPom(pomFile); @@ -82831,7 +84506,7 @@ class MavenWorkspace extends workspace_1.WorkspacePlugin { candidate; } else { - logger_1.logger.warn(`found ${pomFile} in path ${path}, but did not find an associated candidate PR`); + this.logger.warn(`found ${pomFile} in path ${path}, but did not find an associated candidate PR`); } } return { @@ -82868,7 +84543,7 @@ class MavenWorkspace extends workspace_1.WorkspacePlugin { throw new Error(`Didn't find updated version for ${artifact.name}`); } const updater = new pom_xml_1.PomXml(version, updatedVersions); - const dependencyNotes = getChangelogDepsNotes(artifact, updater, updatedVersions); + const dependencyNotes = getChangelogDepsNotes(artifact, updater, updatedVersions, this.logger); existingCandidate.pullRequest.updates = existingCandidate.pullRequest.updates.map(update => { if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'pom.xml')) { @@ -82877,7 +84552,7 @@ class MavenWorkspace extends workspace_1.WorkspacePlugin { else if (update.updater instanceof changelog_1.Changelog) { if (dependencyNotes) { update.updater.changelogEntry = - (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes); + (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes, this.logger); } } return update; @@ -82886,13 +84561,13 @@ class MavenWorkspace extends workspace_1.WorkspacePlugin { if (dependencyNotes) { if (existingCandidate.pullRequest.body.releaseData.length > 0) { existingCandidate.pullRequest.body.releaseData[0].notes = - (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes); + (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes, this.logger); } else { existingCandidate.pullRequest.body.releaseData.push({ component: artifact.name, version: existingCandidate.pullRequest.version, - notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes), + notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger), }); } } @@ -82904,14 +84579,14 @@ class MavenWorkspace extends workspace_1.WorkspacePlugin { throw new Error(`Didn't find updated version for ${artifact.name}`); } const updater = new pom_xml_1.PomXml(version, updatedVersions); - const dependencyNotes = getChangelogDepsNotes(artifact, updater, updatedVersions); + const dependencyNotes = getChangelogDepsNotes(artifact, updater, updatedVersions, this.logger); const pullRequest = { title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch), body: new pull_request_body_1.PullRequestBody([ { component: artifact.name, version, - notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes), + notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger), }, ]), updates: [ @@ -82960,13 +84635,13 @@ exports.MavenWorkspace = MavenWorkspace; function packageNameFromGav(gav) { return `${gav.groupId}:${gav.artifactId}`; } -function getChangelogDepsNotes(artifact, updater, updatedVersions) { +function getChangelogDepsNotes(artifact, updater, updatedVersions, logger = logger_1.logger) { const document = new dom.DOMParser().parseFromString(artifact.pomContent); const dependencyUpdates = updater.dependencyUpdates(document, updatedVersions); const depUpdateNotes = []; for (const dependencyUpdate of dependencyUpdates) { depUpdateNotes.push(`\n * ${dependencyUpdate.name} bumped to ${dependencyUpdate.version}`); - logger_1.logger.info(`bumped ${dependencyUpdate.name} to ${dependencyUpdate.version}`); + logger.info(`bumped ${dependencyUpdate.name} to ${dependencyUpdate.version}`); } if (depUpdateNotes.length > 0) { return `* The following workspace dependencies were updated${depUpdateNotes.join()}`; @@ -83003,7 +84678,6 @@ const pull_request_title_1 = __nccwpck_require__(1158); const pull_request_body_1 = __nccwpck_require__(70774); const branch_name_1 = __nccwpck_require__(16344); const composite_1 = __nccwpck_require__(40911); -const logger_1 = __nccwpck_require__(68809); /** * This plugin merges multiple pull requests into a single * release pull request. @@ -83011,16 +84685,17 @@ const logger_1 = __nccwpck_require__(68809); * Release notes are broken up using ``/`
` blocks. */ class Merge extends plugin_1.ManifestPlugin { - constructor(github, targetBranch, repositoryConfig, pullRequestTitlePattern) { + constructor(github, targetBranch, repositoryConfig, pullRequestTitlePattern, pullRequestHeader) { super(github, targetBranch, repositoryConfig); this.pullRequestTitlePattern = pullRequestTitlePattern || manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN; + this.pullRequestHeader = pullRequestHeader; } async run(candidates) { if (candidates.length < 1) { return candidates; } - logger_1.logger.info(`Merging ${candidates.length} pull requests`); + this.logger.info(`Merging ${candidates.length} pull requests`); const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => { if (candidate.config.separatePullRequests) { collection[1].push(candidate); @@ -83048,7 +84723,10 @@ class Merge extends plugin_1.ManifestPlugin { const updates = (0, composite_1.mergeUpdates)(rawUpdates); const pullRequest = { title: pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.component, this.targetBranch, rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.version, this.pullRequestTitlePattern), - body: new pull_request_body_1.PullRequestBody(releaseData, { useComponents: true }), + body: new pull_request_body_1.PullRequestBody(releaseData, { + useComponents: true, + header: this.pullRequestHeader, + }), updates, labels: Array.from(labels), headRefName: branch_name_1.BranchName.ofTargetBranch(this.targetBranch).toString(), @@ -83095,8 +84773,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.NodeWorkspace = void 0; const package_graph_1 = __nccwpck_require__(69522); const package_1 = __nccwpck_require__(48628); -const logger_1 = __nccwpck_require__(68809); -const manifest_1 = __nccwpck_require__(31999); const version_1 = __nccwpck_require__(17348); const raw_content_1 = __nccwpck_require__(62648); const pull_request_title_1 = __nccwpck_require__(1158); @@ -83141,7 +84817,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { } const candidate = candidatesByPath.get(path); if (candidate) { - logger_1.logger.debug(`Found candidate pull request for path: ${candidate.path}`); + this.logger.debug(`Found candidate pull request for path: ${candidate.path}`); const packagePath = (0, workspace_1.addPath)(candidate.path, 'package.json'); const packageUpdate = candidate.pullRequest.updates.find(update => update.path === packagePath); if (packageUpdate === null || packageUpdate === void 0 ? void 0 : packageUpdate.cachedFileContents) { @@ -83158,7 +84834,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { } else { const packagePath = (0, workspace_1.addPath)(path, 'package.json'); - logger_1.logger.debug(`No candidate pull request for path: ${path} - inspect package from ${packagePath}`); + this.logger.debug(`No candidate pull request for path: ${path} - inspect package from ${packagePath}`); const contents = await this.github.getFileContentsOnBranch(packagePath, this.targetBranch); packagesByPath.set(path, new Package(contents.parsedContent, path)); } @@ -83184,7 +84860,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { // Update version of the package const newVersion = updatedVersions.get(updatedPackage.name); if (newVersion) { - logger_1.logger.info(`Updating ${updatedPackage.name} to ${newVersion}`); + this.logger.info(`Updating ${updatedPackage.name} to ${newVersion}`); updatedPackage.version = newVersion.toString(); } // Update dependency versions @@ -83192,7 +84868,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { const depVersion = updatedVersions.get(depName); if (depVersion && resolved.type !== 'directory') { updatedPackage.updateLocalDependency(resolved, depVersion.toString(), '^'); - logger_1.logger.info(`${pkg.name}.${depName} updated to ^${depVersion.toString()}`); + this.logger.info(`${pkg.name}.${depName} updated to ^${depVersion.toString()}`); } } const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage); @@ -83204,7 +84880,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { else if (update.updater instanceof changelog_1.Changelog) { if (dependencyNotes) { update.updater.changelogEntry = - (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes); + (0, workspace_1.appendDependenciesSectionToChangelog)(update.updater.changelogEntry, dependencyNotes, this.logger); } } return update; @@ -83213,13 +84889,13 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { if (dependencyNotes) { if (existingCandidate.pullRequest.body.releaseData.length > 0) { existingCandidate.pullRequest.body.releaseData[0].notes = - (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes); + (0, workspace_1.appendDependenciesSectionToChangelog)(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes, this.logger); } else { existingCandidate.pullRequest.body.releaseData.push({ component: updatedPackage.name, version: existingCandidate.pullRequest.version, - notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes), + notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger), }); } } @@ -83235,14 +84911,14 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { // Update version of the package const newVersion = updatedVersions.get(updatedPackage.name); if (newVersion) { - logger_1.logger.info(`Updating ${updatedPackage.name} to ${newVersion}`); + this.logger.info(`Updating ${updatedPackage.name} to ${newVersion}`); updatedPackage.version = newVersion.toString(); } for (const [depName, resolved] of graphPackage.localDependencies) { const depVersion = updatedVersions.get(depName); if (depVersion && resolved.type !== 'directory') { updatedPackage.updateLocalDependency(resolved, depVersion.toString(), '^'); - logger_1.logger.info(`${pkg.name}.${depName} updated to ^${depVersion.toString()}`); + this.logger.info(`${pkg.name}.${depName} updated to ^${depVersion.toString()}`); } } const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage); @@ -83254,7 +84930,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { { component: updatedPackage.name, version, - notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes), + notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger), }, ]), updates: [ @@ -83268,7 +84944,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { createIfMissing: false, updater: new changelog_1.Changelog({ version, - changelogEntry: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes), + changelogEntry: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger), }), }, ], @@ -83308,8 +84984,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin { return graph; } inScope(candidate) { - return (candidate.config.releaseType === 'node' && - candidate.path !== manifest_1.ROOT_PROJECT_PATH); + return candidate.config.releaseType === 'node'; } packageNameFromPackage(pkg) { return pkg.name; @@ -83360,6 +85035,90 @@ function getChangelogDepsNotes(original, updated) { /***/ }), +/***/ 36662: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SentenceCase = void 0; +const plugin_1 = __nccwpck_require__(31651); +// A list of words that should not be converted to uppercase: +const SPECIAL_WORDS = ['gRPC', 'npm']; +/** + * This plugin converts commit messages to sentence case, for the benefit + * of the generated CHANGELOG. + */ +class SentenceCase extends plugin_1.ManifestPlugin { + constructor(github, targetBranch, repositoryConfig, specialWords) { + super(github, targetBranch, repositoryConfig); + this.specialWords = new Set(specialWords ? [...specialWords] : SPECIAL_WORDS); + } + /** + * Perform post-processing on commits, e.g, sentence casing them. + * @param {Commit[]} commits The set of commits that will feed into release pull request. + * @returns {Commit[]} The modified commit objects. + */ + processCommits(commits) { + this.logger.info(`SentenceCase processing ${commits.length} commits`); + for (const commit of commits) { + // Check whether commit is in conventional commit format, if it is + // we'll split the string by type and description: + if (commit.message.includes(':')) { + const splitMessage = commit.message.split(':'); + let prefix = splitMessage[0]; + prefix += ': '; + let suffix = splitMessage.slice(1).join(':').trim(); + // Extract the first word from the rest of the string: + const match = /\s|$/.exec(suffix); + if (match) { + const endFirstWord = match.index; + const firstWord = suffix.slice(0, endFirstWord); + suffix = suffix.slice(endFirstWord); + // Put the string back together again: + commit.message = `${prefix}${this.toUpperCase(firstWord)}${suffix}`; + } + } + } + return commits; + } + /* + * Convert a string to upper case, taking into account a dictionary of + * common lowercase words, e.g., gRPC, npm. + * + * @param {string} word The original word. + * @returns {string} The word, now upper case. + */ + toUpperCase(word) { + if (this.specialWords.has(word)) { + return word; + } + if (word.match(/^[a-z]/)) { + return word.charAt(0).toUpperCase() + word.slice(1); + } + else { + return word; + } + } +} +exports.SentenceCase = SentenceCase; +//# sourceMappingURL=sentence-case.js.map + +/***/ }), + /***/ 44226: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -83399,16 +85158,16 @@ const release_please_manifest_1 = __nccwpck_require__(9817); class WorkspacePlugin extends plugin_1.ManifestPlugin { constructor(github, targetBranch, repositoryConfig, options = {}) { var _a, _b, _c; - super(github, targetBranch, repositoryConfig); + super(github, targetBranch, repositoryConfig, options.logger); this.manifestPath = (_a = options.manifestPath) !== null && _a !== void 0 ? _a : manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST; this.updateAllPackages = (_b = options.updateAllPackages) !== null && _b !== void 0 ? _b : false; this.merge = (_c = options.merge) !== null && _c !== void 0 ? _c : true; } async run(candidates) { - logger_1.logger.info('Running workspace plugin'); + this.logger.info('Running workspace plugin'); const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => { if (!candidate.pullRequest.version) { - logger_1.logger.warn('pull request missing version', candidate); + this.logger.warn('pull request missing version', candidate); return collection; } if (this.inScope(candidate)) { @@ -83419,33 +85178,33 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin { } return collection; }, [[], []]); - logger_1.logger.info(`Found ${inScopeCandidates.length} in-scope releases`); + this.logger.info(`Found ${inScopeCandidates.length} in-scope releases`); if (inScopeCandidates.length === 0) { return outOfScopeCandidates; } - logger_1.logger.info('Building list of all packages'); + this.logger.info('Building list of all packages'); const { allPackages, candidatesByPackage } = await this.buildAllPackages(inScopeCandidates); - logger_1.logger.info(`Building dependency graph for ${allPackages.length} packages`); + this.logger.info(`Building dependency graph for ${allPackages.length} packages`); const graph = await this.buildGraph(allPackages); const packageNamesToUpdate = this.updateAllPackages ? allPackages.map(this.packageNameFromPackage) : Object.keys(candidatesByPackage); const orderedPackages = this.buildGraphOrder(graph, packageNamesToUpdate); - logger_1.logger.info(`Updating ${orderedPackages.length} packages`); + this.logger.info(`Updating ${orderedPackages.length} packages`); const updatedVersions = new Map(); const updatedPathVersions = new Map(); for (const pkg of orderedPackages) { const packageName = this.packageNameFromPackage(pkg); - logger_1.logger.debug(`package: ${packageName}`); + this.logger.debug(`package: ${packageName}`); const existingCandidate = candidatesByPackage[packageName]; if (existingCandidate) { const version = existingCandidate.pullRequest.version; - logger_1.logger.debug(`version: ${version} from release-please`); + this.logger.debug(`version: ${version} from release-please`); updatedVersions.set(packageName, version); } else { const version = this.bumpVersion(pkg); - logger_1.logger.debug(`version: ${version} forced bump`); + this.logger.debug(`version: ${version} forced bump`); updatedVersions.set(packageName, version); updatedPathVersions.set(this.pathFromPackage(pkg), version); } @@ -83456,19 +85215,19 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin { const existingCandidate = candidatesByPackage[packageName]; if (existingCandidate) { // if already has an pull request, update the changelog and update - logger_1.logger.info(`Updating exising candidate pull request for ${this.packageNameFromPackage(pkg)}`); + this.logger.info(`Updating exising candidate pull request for ${this.packageNameFromPackage(pkg)}`); const newCandidate = this.updateCandidate(existingCandidate, pkg, updatedVersions); newCandidates.push(newCandidate); } else { // otherwise, build a new pull request with changelog and entry update - logger_1.logger.info(`Creating new candidate pull request for ${this.packageNameFromPackage(pkg)}`); + this.logger.info(`Creating new candidate pull request for ${this.packageNameFromPackage(pkg)}`); const newCandidate = this.newCandidate(pkg, updatedVersions); newCandidates.push(newCandidate); } } if (this.merge) { - logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`); + this.logger.info(`Merging ${newCandidates.length} in-scope candidates`); const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig); newCandidates = await mergePlugin.run(newCandidates); } @@ -83481,7 +85240,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin { versionsMap: updatedPathVersions, }), }); - logger_1.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`); + this.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`); newCandidates = this.postProcessCandidates(newCandidates, updatedVersions); return [...outOfScopeCandidates, ...newCandidates]; } @@ -83515,7 +85274,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin { * being updated. */ buildGraphOrder(graph, packageNamesToUpdate) { - logger_1.logger.info(`building graph order, existing package names: ${packageNamesToUpdate}`); + this.logger.info(`building graph order, existing package names: ${packageNamesToUpdate}`); // invert the graph so it's dependency name => packages that depend on it const dependentGraph = this.invertGraph(graph); const visited = new Set(); @@ -83534,31 +85293,31 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin { } const node = graph.get(name); if (!node) { - logger_1.logger.warn(`Didn't find node: ${name} in graph`); + this.logger.warn(`Didn't find node: ${name} in graph`); return; } const nextPath = [...path, name]; for (const depName of node.deps) { const dep = graph.get(depName); if (!dep) { - logger_1.logger.warn(`dependency not found in graph: ${depName}`); + this.logger.warn(`dependency not found in graph: ${depName}`); return; } this.visitPostOrder(graph, depName, visited, nextPath); } if (!visited.has(node.value)) { - logger_1.logger.debug(`marking ${name} as visited and adding ${this.packageNameFromPackage(node.value)} to order`); + this.logger.debug(`marking ${name} as visited and adding ${this.packageNameFromPackage(node.value)} to order`); visited.add(node.value); } } } exports.WorkspacePlugin = WorkspacePlugin; const DEPENDENCY_HEADER = new RegExp('### Dependencies'); -function appendDependenciesSectionToChangelog(changelog, notes) { +function appendDependenciesSectionToChangelog(changelog, notes, logger = logger_1.logger) { if (!changelog) { return `### Dependencies\n\n${notes}`; } - logger_1.logger.info('appending dependency notes to changelog'); + logger.info('appending dependency notes to changelog'); const newLines = []; let seenDependenciesSection = false; let seenDependencySectionSpacer = false; @@ -83641,14 +85400,16 @@ const DEFAULT_CHANGELOG_PATH = 'CHANGELOG.md'; */ class BaseStrategy { constructor(options) { - var _a, _b; + var _a, _b, _c; + this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : logger_1.logger; this.path = options.path || manifest_1.ROOT_PROJECT_PATH; this.github = options.github; this.packageName = options.packageName; this.component = options.component || this.normalizeComponent(this.packageName); this.versioningStrategy = - options.versioningStrategy || new default_1.DefaultVersioningStrategy({}); + options.versioningStrategy || + new default_1.DefaultVersioningStrategy({ logger: this.logger }); this.targetBranch = options.targetBranch; this.repository = options.github.repository; this.changelogPath = options.changelogPath || DEFAULT_CHANGELOG_PATH; @@ -83659,9 +85420,10 @@ class BaseStrategy { this.releaseAs = options.releaseAs; this.changelogNotes = options.changelogNotes || new default_2.DefaultChangelogNotes(options); - this.includeComponentInTag = (_a = options.includeComponentInTag) !== null && _a !== void 0 ? _a : true; - this.includeVInTag = (_b = options.includeVInTag) !== null && _b !== void 0 ? _b : true; + this.includeComponentInTag = (_b = options.includeComponentInTag) !== null && _b !== void 0 ? _b : true; + this.includeVInTag = (_c = options.includeVInTag) !== null && _c !== void 0 ? _c : true; this.pullRequestTitlePattern = options.pullRequestTitlePattern; + this.pullRequestHeader = options.pullRequestHeader; this.extraFiles = options.extraFiles || []; } /** @@ -83717,14 +85479,14 @@ class BaseStrategy { commits: commits, }); } - async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease) { + async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease, pullRequestHeader) { return new pull_request_body_1.PullRequestBody([ { component, version: newVersion, notes: releaseNotesBody, }, - ]); + ], { header: pullRequestHeader }); } /** * Builds a candidate release pull request @@ -83738,18 +85500,18 @@ class BaseStrategy { * open a pull request. */ async buildReleasePullRequest(commits, latestRelease, draft, labels = []) { - const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits)); - logger_1.logger.info(`Considering: ${conventionalCommits.length} commits`); + const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits, this.logger)); + this.logger.info(`Considering: ${conventionalCommits.length} commits`); if (conventionalCommits.length === 0) { - logger_1.logger.info(`No commits for path: ${this.path}, skipping`); + this.logger.info(`No commits for path: ${this.path}, skipping`); return undefined; } const newVersion = await this.buildNewVersion(conventionalCommits, latestRelease); const versionsMap = await this.updateVersionsMap(await this.buildVersionsMap(conventionalCommits), conventionalCommits, newVersion); const component = await this.getComponent(); - logger_1.logger.debug('component:', component); + this.logger.debug('component:', component); const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag); - logger_1.logger.debug('pull request title pattern:', this.pullRequestTitlePattern); + this.logger.debug('pull request title pattern:', this.pullRequestTitlePattern); const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern); const branchComponent = await this.getBranchComponent(); const branchName = branchComponent @@ -83757,7 +85519,7 @@ class BaseStrategy { : branch_name_1.BranchName.ofTargetBranch(this.targetBranch); const releaseNotesBody = await this.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits); if (this.changelogEmpty(releaseNotesBody)) { - logger_1.logger.info(`No user facing commits found since ${latestRelease ? latestRelease.sha : 'beginning of time'} - skipping`); + this.logger.info(`No user facing commits found since ${latestRelease ? latestRelease.sha : 'beginning of time'} - skipping`); return undefined; } const updates = await this.buildUpdates({ @@ -83766,8 +85528,8 @@ class BaseStrategy { versionsMap, latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version, }); - const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...this.extraFileUpdates(newVersion, versionsMap))); - const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease); + const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...(await this.extraFileUpdates(newVersion, versionsMap)))); + const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease, this.pullRequestHeader); return { title: pullRequestTitle, body: pullRequestBody, @@ -83778,44 +85540,77 @@ class BaseStrategy { draft: draft !== null && draft !== void 0 ? draft : false, }; } - extraFileUpdates(version, versionsMap) { - return this.extraFiles.map(extraFile => { + // Helper to convert extra files with globs to the file paths to add + async extraFilePaths(extraFile) { + if (typeof extraFile !== 'object') { + return [extraFile]; + } + if (!extraFile.glob) { + return [extraFile.path]; + } + if (extraFile.path.startsWith('/')) { + // glob is relative to root, strip the leading `/` for glob matching + // and re-add the leading `/` to make the file relative to the root + return (await this.github.findFilesByGlobAndRef(extraFile.path.slice(1), this.targetBranch)).map(file => `/${file}`); + } + else if (this.path === manifest_1.ROOT_PROJECT_PATH) { + // root component, ignore path prefix + return this.github.findFilesByGlobAndRef(extraFile.path, this.targetBranch); + } + else { + // glob is relative to current path + return this.github.findFilesByGlobAndRef(extraFile.path, this.targetBranch, this.path); + } + } + async extraFileUpdates(version, versionsMap) { + const extraFileUpdates = []; + for (const extraFile of this.extraFiles) { if (typeof extraFile === 'object') { - switch (extraFile.type) { - case 'json': - return { - path: this.addPath(extraFile.path), - createIfMissing: false, - updater: new generic_json_1.GenericJson(extraFile.jsonpath, version), - }; - case 'yaml': - return { - path: this.addPath(extraFile.path), - createIfMissing: false, - updater: new generic_yaml_1.GenericYaml(extraFile.jsonpath, version), - }; - case 'xml': - return { - path: this.addPath(extraFile.path), - createIfMissing: false, - updater: new generic_xml_1.GenericXml(extraFile.xpath, version), - }; - case 'pom': - return { - path: this.addPath(extraFile.path), - createIfMissing: false, - updater: new pom_xml_1.PomXml(version), - }; - default: - throw new Error(`unsupported extraFile type: ${extraFile.type}`); + const paths = await this.extraFilePaths(extraFile); + for (const path of paths) { + switch (extraFile.type) { + case 'json': + extraFileUpdates.push({ + path: this.addPath(path), + createIfMissing: false, + updater: new generic_json_1.GenericJson(extraFile.jsonpath, version), + }); + break; + case 'yaml': + extraFileUpdates.push({ + path: this.addPath(path), + createIfMissing: false, + updater: new generic_yaml_1.GenericYaml(extraFile.jsonpath, version), + }); + break; + case 'xml': + extraFileUpdates.push({ + path: this.addPath(path), + createIfMissing: false, + updater: new generic_xml_1.GenericXml(extraFile.xpath, version), + }); + break; + case 'pom': + extraFileUpdates.push({ + path: this.addPath(path), + createIfMissing: false, + updater: new pom_xml_1.PomXml(version), + }); + break; + default: + throw new Error(`unsupported extraFile type: ${extraFile.type}`); + } } } - return { - path: this.addPath(extraFile), - createIfMissing: false, - updater: new generic_1.Generic({ version, versionsMap }), - }; - }); + else { + extraFileUpdates.push({ + path: this.addPath(extraFile), + createIfMissing: false, + updater: new generic_1.Generic({ version, versionsMap }), + }); + } + } + return extraFileUpdates; } changelogEmpty(changelogEntry) { return changelogEntry.split('\n').length <= 1; @@ -83828,7 +85623,7 @@ class BaseStrategy { } async buildNewVersion(conventionalCommits, latestRelease) { if (this.releaseAs) { - logger_1.logger.warn(`Setting version for ${this.path} from release-as configuration`); + this.logger.warn(`Setting version for ${this.path} from release-as configuration`); return version_1.Version.parse(this.releaseAs); } const releaseAsCommit = conventionalCommits.find(conventionalCommit => conventionalCommit.notes.find(note => note.title === 'RELEASE AS')); @@ -83847,7 +85642,7 @@ class BaseStrategy { return new Map(); } async parsePullRequestBody(pullRequestBody) { - return pull_request_body_1.PullRequestBody.parse(pullRequestBody); + return pull_request_body_1.PullRequestBody.parse(pullRequestBody, this.logger); } /** * Given a merged pull request, build the candidate release. @@ -83856,27 +85651,27 @@ class BaseStrategy { */ async buildRelease(mergedPullRequest) { if (this.skipGitHubRelease) { - logger_1.logger.info('Release skipped from strategy config'); + this.logger.info('Release skipped from strategy config'); return; } if (!mergedPullRequest.sha) { - logger_1.logger.error('Pull request should have been merged'); + this.logger.error('Pull request should have been merged'); return; } - const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, this.pullRequestTitlePattern) || - pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN); + const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, this.pullRequestTitlePattern, this.logger) || + pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN, this.logger); if (!pullRequestTitle) { - logger_1.logger.error(`Bad pull request title: '${mergedPullRequest.title}'`); + this.logger.error(`Bad pull request title: '${mergedPullRequest.title}'`); return; } - const branchName = branch_name_1.BranchName.parse(mergedPullRequest.headBranchName); + const branchName = branch_name_1.BranchName.parse(mergedPullRequest.headBranchName, this.logger); if (!branchName) { - logger_1.logger.error(`Bad branch name: ${mergedPullRequest.headBranchName}`); + this.logger.error(`Bad branch name: ${mergedPullRequest.headBranchName}`); return; } const pullRequestBody = await this.parsePullRequestBody(mergedPullRequest.body); if (!pullRequestBody) { - logger_1.logger.error('Could not parse pull request body as a release PR'); + this.logger.error('Could not parse pull request body as a release PR'); return; } const component = await this.getComponent(); @@ -83887,7 +85682,7 @@ class BaseStrategy { // standalone release PR, ensure the components match if (this.normalizeComponent(branchName.component) !== this.normalizeComponent(branchComponent)) { - logger_1.logger.warn(`PR component: ${branchName.component} does not match configured component: ${branchComponent}`); + this.logger.warn(`PR component: ${branchName.component} does not match configured component: ${branchComponent}`); return; } releaseData = pullRequestBody.releaseData[0]; @@ -83901,17 +85696,17 @@ class BaseStrategy { this.normalizeComponent(component)); }); if (!releaseData && pullRequestBody.releaseData.length > 0) { - logger_1.logger.info(`Pull request contains releases, but not for component: ${component}`); + this.logger.info(`Pull request contains releases, but not for component: ${component}`); return; } } const notes = releaseData === null || releaseData === void 0 ? void 0 : releaseData.notes; if (notes === undefined) { - logger_1.logger.warn('Failed to find release notes'); + this.logger.warn('Failed to find release notes'); } const version = pullRequestTitle.getVersion() || (releaseData === null || releaseData === void 0 ? void 0 : releaseData.version); if (!version) { - logger_1.logger.error('Pull request should have included version'); + this.logger.error('Pull request should have included version'); return; } const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag); @@ -84053,7 +85848,6 @@ exports.DotnetYoshi = void 0; const base_1 = __nccwpck_require__(95081); const changelog_1 = __nccwpck_require__(3325); const apis_1 = __nccwpck_require__(4856); -const logger_1 = __nccwpck_require__(68809); const errors_1 = __nccwpck_require__(93637); const CHANGELOG_SECTIONS = [ { type: 'feat', section: 'New features' }, @@ -84070,15 +85864,18 @@ const CHANGELOG_SECTIONS = [ ]; const DEFAULT_CHANGELOG_PATH = 'docs/history.md'; const DEFAULT_PULL_REQUEST_TITLE_PATTERN = 'Release${component} version ${version}'; +const DEFAULT_PULL_REQUEST_HEADER = ':robot: I have created a release *beep* *boop*'; const RELEASE_NOTES_HEADER_PATTERN = /#{2,3} \[?(\d+\.\d+\.\d+-?[^\]]*)\]?.* \((\d{4}-\d{2}-\d{2})\)/; class DotnetYoshi extends base_1.BaseStrategy { constructor(options) { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e; options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS; options.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : DEFAULT_CHANGELOG_PATH; options.pullRequestTitlePattern = (_c = options.pullRequestTitlePattern) !== null && _c !== void 0 ? _c : DEFAULT_PULL_REQUEST_TITLE_PATTERN; - options.includeVInTag = (_d = options.includeVInTag) !== null && _d !== void 0 ? _d : false; + options.pullRequestHeader = + (_d = options.pullRequestHeader) !== null && _d !== void 0 ? _d : DEFAULT_PULL_REQUEST_HEADER; + options.includeVInTag = (_e = options.includeVInTag) !== null && _e !== void 0 ? _e : false; super(options); } async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) { @@ -84110,7 +85907,7 @@ class DotnetYoshi extends base_1.BaseStrategy { const component = await this.getComponent(); const api = await this.getApi(); if (api === null || api === void 0 ? void 0 : api.noVersionHistory) { - logger_1.logger.info(`Skipping changelog for ${component} via noVersionHistory configuration`); + this.logger.info(`Skipping changelog for ${component} via noVersionHistory configuration`); } else { updates.push({ @@ -84124,7 +85921,7 @@ class DotnetYoshi extends base_1.BaseStrategy { }); } if (!component) { - logger_1.logger.warn('Dotnet strategy expects to use components, could not update all files'); + this.logger.warn('Dotnet strategy expects to use components, could not update all files'); return updates; } updates.push({ @@ -84216,7 +86013,6 @@ const base_1 = __nccwpck_require__(95081); const changelog_1 = __nccwpck_require__(3325); const version_1 = __nccwpck_require__(17348); const version_go_1 = __nccwpck_require__(54988); -const logger_1 = __nccwpck_require__(68809); const path_1 = __nccwpck_require__(85622); const CHANGELOG_SECTIONS = [ { type: 'feat', section: 'Features' }, @@ -84265,7 +86061,7 @@ class GoYoshi extends base_1.BaseStrategy { async postProcessCommits(commits) { let regenCommit; const component = await this.getComponent(); - logger_1.logger.debug('Filtering commits'); + this.logger.debug('Filtering commits'); const ignoredSubmodules = await this.getIgnoredSubModules(); return commits.filter(commit => { var _a, _b; @@ -84306,7 +86102,7 @@ class GoYoshi extends base_1.BaseStrategy { // Skip commits that don't have a scope as we don't know where to // put them if (!commit.scope) { - logger_1.logger.debug(`Skipping commit without scope: ${commit.message}`); + this.logger.debug(`Skipping commit without scope: ${commit.message}`); return false; } // Skip commits related to sub-modules as they are not part of @@ -84315,7 +86111,7 @@ class GoYoshi extends base_1.BaseStrategy { // This is a submodule release, so only include commits in this // scope if (!commitMatchesScope(commit.scope, component)) { - logger_1.logger.debug(`Skipping commit scope: ${commit.scope} != ${component}`); + this.logger.debug(`Skipping commit scope: ${commit.scope} != ${component}`); return false; } } @@ -84324,7 +86120,7 @@ class GoYoshi extends base_1.BaseStrategy { // are released independently for (const submodule of ignoredSubmodules) { if (commitMatchesScope(commit.scope, submodule)) { - logger_1.logger.debug(`Skipping ignored commit scope: ${commit.scope}`); + this.logger.debug(`Skipping ignored commit scope: ${commit.scope}`); return false; } } @@ -84341,12 +86137,12 @@ class GoYoshi extends base_1.BaseStrategy { this.includeComponentInTag) { return new Set(); } - logger_1.logger.info('Looking for go.mod files'); + this.logger.info('Looking for go.mod files'); const paths = (await this.github.findFilesByFilenameAndRef('go.mod', this.targetBranch)) .filter(path => !path.includes('internal') && path !== 'go.mod') .map(path => (0, path_1.dirname)(path)); - logger_1.logger.info(`Found ${paths.length} submodules`); - logger_1.logger.debug(JSON.stringify(paths)); + this.logger.info(`Found ${paths.length} submodules`); + this.logger.debug(JSON.stringify(paths)); return new Set(paths); } // "closes" is a little presumptuous, let's just indicate that the @@ -84504,7 +86300,6 @@ const versions_manifest_1 = __nccwpck_require__(78345); const version_1 = __nccwpck_require__(17348); const changelog_1 = __nccwpck_require__(3325); const errors_1 = __nccwpck_require__(93637); -const logger_1 = __nccwpck_require__(68809); const java_1 = __nccwpck_require__(46892); const java_update_1 = __nccwpck_require__(90276); class JavaYoshi extends java_1.Java { @@ -84648,7 +86443,7 @@ class JavaYoshi extends java_1.Java { for (const versionKey of versionsMap.keys()) { const version = versionsMap.get(versionKey); if (!version) { - logger_1.logger.warn(`didn't find version for ${versionKey}`); + this.logger.warn(`didn't find version for ${versionKey}`); continue; } if (isPromotion && isStableArtifact(versionKey)) { @@ -84718,7 +86513,6 @@ exports.Java = void 0; const base_1 = __nccwpck_require__(95081); const changelog_1 = __nccwpck_require__(3325); const java_snapshot_1 = __nccwpck_require__(66860); -const logger_1 = __nccwpck_require__(68809); const pull_request_title_1 = __nccwpck_require__(1158); const branch_name_1 = __nccwpck_require__(16344); const pull_request_body_1 = __nccwpck_require__(70774); @@ -84727,6 +86521,7 @@ const java_add_snapshot_1 = __nccwpck_require__(87719); const manifest_1 = __nccwpck_require__(31999); const java_released_1 = __nccwpck_require__(16255); const composite_1 = __nccwpck_require__(40911); +const logger_1 = __nccwpck_require__(68809); const CHANGELOG_SECTIONS = [ { type: 'feat', section: 'Features' }, { type: 'fix', section: 'Bug Fixes' }, @@ -84748,22 +86543,23 @@ const CHANGELOG_SECTIONS = [ */ class Java extends base_1.BaseStrategy { constructor(options) { - var _a, _b; + var _a, _b, _c; options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS; // wrap the configured versioning strategy with snapshotting - const parentVersioningStrategy = options.versioningStrategy || new default_1.DefaultVersioningStrategy(); + const parentVersioningStrategy = options.versioningStrategy || + new default_1.DefaultVersioningStrategy({ logger: (_b = options.logger) !== null && _b !== void 0 ? _b : logger_1.logger }); options.versioningStrategy = new java_snapshot_1.JavaSnapshot(parentVersioningStrategy); super(options); this.snapshotVersioning = new java_add_snapshot_1.JavaAddSnapshot(parentVersioningStrategy); this.snapshotLabels = options.snapshotLabels || manifest_1.DEFAULT_SNAPSHOT_LABELS; - this.skipSnapshot = (_b = options.skipSnapshot) !== null && _b !== void 0 ? _b : false; + this.skipSnapshot = (_c = options.skipSnapshot) !== null && _c !== void 0 ? _c : false; } async buildReleasePullRequest(commits, latestRelease, draft, labels = []) { if (await this.needsSnapshot(commits, latestRelease)) { - logger_1.logger.info('Repository needs a snapshot bump.'); + this.logger.info('Repository needs a snapshot bump.'); return await this.buildSnapshotPullRequest(latestRelease, draft, this.snapshotLabels); } - logger_1.logger.info('No Java snapshot needed'); + this.logger.info('No Java snapshot needed'); return await super.buildReleasePullRequest(commits, latestRelease, draft, labels); } async buildSnapshotPullRequest(latestRelease, draft, labels = []) { @@ -84780,6 +86576,7 @@ class Java extends base_1.BaseStrategy { ? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch) : branch_name_1.BranchName.ofTargetBranch(this.targetBranch); const notes = '### Updating meta-information for bleeding-edge SNAPSHOT release.'; + // TODO use pullrequest header here? const pullRequestBody = new pull_request_body_1.PullRequestBody([ { component, @@ -84793,7 +86590,7 @@ class Java extends base_1.BaseStrategy { changelogEntry: notes, isSnapshot: true, }); - const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...this.extraFileUpdates(newVersion, versionsMap))); + const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...(await this.extraFileUpdates(newVersion, versionsMap)))); return { title: pullRequestTitle, body: pullRequestBody, @@ -84813,7 +86610,7 @@ class Java extends base_1.BaseStrategy { return false; } const component = await this.getComponent(); - logger_1.logger.debug('component:', component); + this.logger.debug('component:', component); const version = (_a = latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag) === null || _a === void 0 ? void 0 : _a.version; if (!version) { // Don't bump snapshots for the first release ever @@ -84827,7 +86624,7 @@ class Java extends base_1.BaseStrategy { const pullRequests = commits .map(commit => { var _a; - return pull_request_title_1.PullRequestTitle.parse(((_a = commit.pullRequest) === null || _a === void 0 ? void 0 : _a.title) || commit.message, this.pullRequestTitlePattern); + return pull_request_title_1.PullRequestTitle.parse(((_a = commit.pullRequest) === null || _a === void 0 ? void 0 : _a.title) || commit.message, this.pullRequestTitlePattern, this.logger); }) .filter(pullRequest => pullRequest); const snapshotCommits = pullRequests @@ -85214,7 +87011,6 @@ const version_1 = __nccwpck_require__(17348); const commit_1 = __nccwpck_require__(69158); const commit_split_1 = __nccwpck_require__(6941); const default_1 = __nccwpck_require__(69995); -const logger_1 = __nccwpck_require__(68809); const tag_name_1 = __nccwpck_require__(36503); const pull_request_title_1 = __nccwpck_require__(1158); const branch_name_1 = __nccwpck_require__(16344); @@ -85242,9 +87038,9 @@ class PHPYoshi extends base_1.BaseStrategy { } async buildReleasePullRequest(commits, latestRelease, draft, labels = []) { var _a, _b, _c; - const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits)); + const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits, this.logger)); if (conventionalCommits.length === 0) { - logger_1.logger.info(`No commits for path: ${this.path}, skipping`); + this.logger.info(`No commits for path: ${this.path}, skipping`); return undefined; } const newVersion = latestRelease @@ -85306,7 +87102,7 @@ class PHPYoshi extends base_1.BaseStrategy { const componentInfo = directoryVersionContents[directory]; const version = versionsMap.get(componentInfo.composer.name); if (!version) { - logger_1.logger.warn(`No version found for ${componentInfo.composer.name}`); + this.logger.warn(`No version found for ${componentInfo.composer.name}`); continue; } updates.push({ @@ -85327,6 +87123,7 @@ class PHPYoshi extends base_1.BaseStrategy { }); } } + // TODO use pullrequest header here? const pullRequestBody = new pull_request_body_1.PullRequestBody([ { component, @@ -85345,7 +87142,7 @@ class PHPYoshi extends base_1.BaseStrategy { }; } async parsePullRequestBody(pullRequestBody) { - const body = pull_request_body_1.PullRequestBody.parse(pullRequestBody); + const body = pull_request_body_1.PullRequestBody.parse(pullRequestBody, this.logger); if (!body) { return undefined; } @@ -85530,7 +87327,6 @@ const version_1 = __nccwpck_require__(17348); const setup_cfg_1 = __nccwpck_require__(40483); const setup_py_1 = __nccwpck_require__(11519); const pyproject_toml_1 = __nccwpck_require__(89290); -const logger_1 = __nccwpck_require__(68809); const python_file_with_version_1 = __nccwpck_require__(70464); const CHANGELOG_SECTIONS = [ { type: 'feat', section: 'Features' }, @@ -85592,12 +87388,12 @@ class Python extends base_1.BaseStrategy { projectName = pyProject.name; } else { - logger_1.logger.warn(parsedPyProject + this.logger.warn(parsedPyProject ? 'invalid pyproject.toml' : `file ${this.addPath('pyproject.toml')} did not exist`); } if (!projectName) { - logger_1.logger.warn('No project/component found.'); + this.logger.warn('No project/component found.'); } else { [projectName, projectName.replace(/-/g, '_')] @@ -85840,7 +87636,6 @@ const changelog_1 = __nccwpck_require__(3325); const cargo_toml_1 = __nccwpck_require__(90420); const cargo_lock_1 = __nccwpck_require__(68875); const common_1 = __nccwpck_require__(11659); -const logger_1 = __nccwpck_require__(68809); const base_1 = __nccwpck_require__(95081); const version_1 = __nccwpck_require__(17348); class Rust extends base_1.BaseStrategy { @@ -85864,28 +87659,28 @@ class Rust extends base_1.BaseStrategy { versionsMap.set(workspaceManifest.package.name, version); } else { - logger_1.logger.warn('No workspace manifest package name found'); + this.logger.warn('No workspace manifest package name found'); } - logger_1.logger.info(`found workspace with ${members.length} members, upgrading all`); + this.logger.info(`found workspace with ${members.length} members, upgrading all`); // Collect submodule names to update const manifestsByPath = new Map(); for (const member of members) { const manifestPath = `${member}/Cargo.toml`; const manifestContent = await this.getContent(manifestPath); if (!manifestContent) { - logger_1.logger.warn(`member ${member} declared but did not find Cargo.toml`); + this.logger.warn(`member ${member} declared but did not find Cargo.toml`); continue; } const manifest = (0, common_1.parseCargoManifest)(manifestContent.parsedContent); manifestsByPath.set(manifestPath, manifestContent); if (!((_c = manifest.package) === null || _c === void 0 ? void 0 : _c.name)) { - logger_1.logger.warn(`member ${member} has no package name`); + this.logger.warn(`member ${member} has no package name`); continue; } versionsMap.set(manifest.package.name, version); } - logger_1.logger.info(`updating ${manifestsByPath.size} submodules`); - logger_1.logger.debug('versions map:', versionsMap); + this.logger.info(`updating ${manifestsByPath.size} submodules`); + this.logger.debug('versions map:', versionsMap); for (const [manifestPath, manifestContent] of manifestsByPath) { updates.push({ path: this.addPath(manifestPath), @@ -85908,13 +87703,13 @@ class Rust extends base_1.BaseStrategy { }); } else { - logger_1.logger.info('single crate found, updating Cargo.toml'); + this.logger.info('single crate found, updating Cargo.toml'); const packageName = await this.getDefaultPackageName(); if (packageName) { versionsMap.set(packageName, version); } else { - logger_1.logger.warn('No crate package name found'); + this.logger.warn('No crate package name found'); } updates.push({ path: this.addPath('Cargo.toml'), @@ -86186,7 +87981,12 @@ class Changelog extends default_1.DefaultUpdater { // Handle both H2 (features/BREAKING CHANGES) and H3 (fixes). const lastEntryIndex = content.search(this.versionHeaderRegex); if (lastEntryIndex === -1) { - return `${this.header()}\n${this.changelogEntry}\n`; + if (content) { + return `${this.header()}\n${this.changelogEntry}\n\n${adjustHeaders(content).trim()}\n`; + } + else { + return `${this.header()}\n${this.changelogEntry}\n`; + } } else { const before = content.slice(0, lastEntryIndex); @@ -86201,6 +88001,10 @@ class Changelog extends default_1.DefaultUpdater { } } exports.Changelog = Changelog; +// Helper to increase markdown H1 headers to H2 +function adjustHeaders(content) { + return content.replace(/^#(\s)/gm, '##$1'); +} //# sourceMappingURL=changelog.js.map /***/ }), @@ -86308,7 +88112,7 @@ class PubspecYaml extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const oldVersion = content.match(/^version: ([0-9.]+)\+?(.*$)/m); let buildNumber = ''; if (oldVersion) { @@ -86316,14 +88120,14 @@ class PubspecYaml extends default_1.DefaultUpdater { const parsedBuild = parseInt(buildNumber); if (!isNaN(parsedBuild)) { buildNumber = `+${parsedBuild + 1}`; - logger_1.logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`); + logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`); } else if (buildNumber.length > 0) { buildNumber = `+${buildNumber}`; - logger_1.logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`); + logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`); } else { - logger_1.logger.info(`updating from ${oldVersion[1]} to ${this.version}`); + logger.info(`updating from ${oldVersion[1]} to ${this.version}`); } } return content.replace(/^version: .*$/m, `version: ${this.version}${buildNumber}`); @@ -86413,11 +88217,11 @@ class Apis { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const data = JSON.parse(content); const api = data.apis.find(api => api.id === this.component); if (!api) { - logger_1.logger.warn(`Failed to find component: ${this.component} in apis.json`); + logger.warn(`Failed to find component: ${this.component} in apis.json`); return content; } api.version = this.version.toString(); @@ -86460,10 +88264,15 @@ class ElixirMixExs extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { - const oldVersion = content.match(/version: "([A-Za-z0-9_\-+.~]+)",/); - if (oldVersion) { - logger_1.logger.info(`updating from ${oldVersion[1]} to ${this.version}`); + updateContent(content, logger = logger_1.logger) { + const oldModuleAttributeVersion = content.match(/@version "([A-Za-z0-9_\-+.~]+)"/); + if (oldModuleAttributeVersion) { + logger.info(`updating module attribute version from ${oldModuleAttributeVersion[1]} to ${this.version}`); + return content.replace(/@version "[A-Za-z0-9_\-+.~]+"/, `@version "${this.version}"`); + } + const oldInlineVersion = content.match(/version: "([A-Za-z0-9_\-+.~]+)"/); + if (oldInlineVersion) { + logger.info(`updating inline version from ${oldInlineVersion[1]} to ${this.version}`); } return content.replace(/version: "[A-Za-z0-9_\-+.~]+",/, `version: "${this.version}",`); } @@ -86506,13 +88315,13 @@ class GenericJson { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const data = JSON.parse(content); const nodes = jp.apply(data, this.jsonpath, _val => { return this.version.toString(); }); if (!nodes) { - logger_1.logger.warn(`No entries modified in ${this.jsonpath}`); + logger.warn(`No entries modified in ${this.jsonpath}`); return content; } return (0, json_stringify_1.jsonStringify)(data, content); @@ -86611,14 +88420,14 @@ class GenericYaml { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { // Parse possibly multi-document file let docs; try { docs = yaml.loadAll(content, null, { json: true }); } catch (e) { - logger_1.logger.warn('Invalid yaml, cannot be parsed', e); + logger.warn('Invalid yaml, cannot be parsed', e); return content; } // Update each document @@ -86633,7 +88442,7 @@ class GenericYaml { }); // If nothing was modified, return original content if (!modified) { - logger_1.logger.warn(`No entries modified in ${this.jsonpath}`); + logger.warn(`No entries modified in ${this.jsonpath}`); return content; } // Stringify documents @@ -86715,7 +88524,7 @@ class Generic extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { if (!content) { return ''; } @@ -86736,7 +88545,7 @@ class Generic extends default_1.DefaultUpdater { newLines.push(line.replace(VERSION_REGEX, version.toString())); return; default: - logger_1.logger.warn(`unknown block scope: ${scope}`); + logger.warn(`unknown block scope: ${scope}`); newLines.push(line); } } @@ -86839,13 +88648,13 @@ class ChartYaml extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const data = yaml.load(content, { json: true }); if (data === null || data === undefined) { return ''; } const parsed = JSON.parse(JSON.stringify(data)); - logger_1.logger.info(`updating from ${parsed.version} to ${this.version}`); + logger.info(`updating from ${parsed.version} to ${this.version}`); parsed.version = this.version.toString(); return yaml.dump(parsed); } @@ -86962,9 +88771,9 @@ class JavaUpdate extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { if (!this.versionsMap) { - logger_1.logger.warn('missing versions map'); + logger.warn('missing versions map'); return content; } const newLines = []; @@ -87184,9 +88993,9 @@ class VersionsManifest extends java_update_1.JavaUpdate { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { if (!this.versionsMap) { - logger_1.logger.warn('missing versions map'); + logger.warn('missing versions map'); return content; } let newContent = content; @@ -87259,7 +89068,7 @@ class KRMBlueprintVersion extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { var _a; // js-yaml(and kpt TS SDK) does not preserve comments hence regex match // match starting cnrm/ ending with semver to prevent wrong updates like pinned config.kubernetes.io/function @@ -87270,7 +89079,7 @@ class KRMBlueprintVersion extends default_1.DefaultUpdater { } const oldVersion = content.match(new RegExp(matchRegex)); if (oldVersion) { - logger_1.logger.info(`updating from ${oldVersion[2]} to v${this.version}`); + logger.info(`updating from ${oldVersion[2]} to v${this.version}`); } const newVersion = content.replace(new RegExp(matchRegex, 'g'), `$1v${this.version}`); return newVersion; @@ -87313,9 +89122,9 @@ class PackageJson extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const parsed = JSON.parse(content); - logger_1.logger.info(`updating from ${parsed.version} to ${this.version}`); + logger.info(`updating from ${parsed.version} to ${this.version}`); parsed.version = this.version.toString(); return (0, json_stringify_1.jsonStringify)(parsed, content); } @@ -87353,9 +89162,9 @@ const default_1 = __nccwpck_require__(69995); * version (for a v2 lock file). */ class PackageLockJson extends default_1.DefaultUpdater { - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const parsed = JSON.parse(content); - logger_1.logger.info(`updating from ${parsed.version} to ${this.version}`); + logger.info(`updating from ${parsed.version} to ${this.version}`); parsed.version = this.version.toString(); if (parsed.lockfileVersion === 2) { parsed.packages[''].version = this.version.toString(); @@ -87409,12 +89218,12 @@ class SamplesPackageJson extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const parsed = JSON.parse(content); if (!parsed.dependencies || !parsed.dependencies[this.packageName]) { return content; } - logger_1.logger.info(`updating ${this.packageName} dependency from ${parsed.dependencies[this.packageName]} to ^${this.version}`); + logger.info(`updating ${this.packageName} dependency from ${parsed.dependencies[this.packageName]} to ^${this.version}`); parsed.dependencies[this.packageName] = `^${this.version}`; return (0, json_stringify_1.jsonStringify)(parsed, content); } @@ -87455,10 +89264,10 @@ class DuneProject extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const oldVersion = content.match(/^\(version ([A-Za-z0-9_\-+.~]+)\)$/m); if (oldVersion) { - logger_1.logger.info(`updating from ${oldVersion[1]} to ${this.version}`); + logger.info(`updating from ${oldVersion[1]} to ${this.version}`); } return content.replace(/^\(version ([A-Za-z0-9_\-+.~]+)\)$/m, `(version ${this.version})`); } @@ -87500,9 +89309,9 @@ class EsyJson extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const parsed = JSON.parse(content); - logger_1.logger.info(`updating from ${parsed.version} to ${this.version}`); + logger.info(`updating from ${parsed.version} to ${this.version}`); parsed.version = this.version.toString(); return (0, json_stringify_1.jsonStringify)(parsed, content); } @@ -87543,10 +89352,10 @@ class Opam extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const oldVersion = content.match(/^version: "([A-Za-z0-9_\-+.~]+)"$/m); if (oldVersion) { - logger_1.logger.info(`updating from ${oldVersion[1]} to ${this.version}`); + logger.info(`updating from ${oldVersion[1]} to ${this.version}`); } return content.replace(/^version: "[A-Za-z0-9_\-+.~]+"$/m, `version: "${this.version}"`); } @@ -87628,9 +89437,9 @@ class PHPManifest extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { if (!this.versionsMap || this.versionsMap.size === 0) { - logger_1.logger.info('no updates necessary'); + logger.info('no updates necessary'); return content; } const parsed = JSON.parse(content); @@ -87639,7 +89448,7 @@ class PHPManifest extends default_1.DefaultUpdater { return; for (const [key, version] of this.versionsMap) { if (module.name === key) { - logger_1.logger.info(`adding ${key}@${version} to manifest`); + logger.info(`adding ${key}@${version} to manifest`); module.versions.unshift(`v${version}`); } } @@ -87689,9 +89498,9 @@ class RootComposerUpdatePackages extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { if (!this.versionsMap || this.versionsMap.size === 0) { - logger_1.logger.info('no updates necessary'); + logger.info('no updates necessary'); return content; } const parsed = JSON.parse(content); @@ -87707,7 +89516,7 @@ class RootComposerUpdatePackages extends default_1.DefaultUpdater { fromVersion !== null && fromVersion !== void 0 ? fromVersion : (fromVersion = parsed[key]); parsed[key] = toVersion; } - logger_1.logger.info(`updating ${key} from ${fromVersion} to ${toVersion}`); + logger.info(`updating ${key} from ${fromVersion} to ${toVersion}`); } } return (0, json_stringify_1.jsonStringify)(parsed, content); @@ -87755,13 +89564,13 @@ class PyProjectToml extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { var _a; const parsed = parsePyProject(content); const project = parsed.project || ((_a = parsed.tool) === null || _a === void 0 ? void 0 : _a.poetry); if (!(project === null || project === void 0 ? void 0 : project.version)) { const msg = 'invalid file'; - logger_1.logger.error(msg); + logger.error(msg); throw new Error(msg); } return (0, toml_edit_1.replaceTomlValue)(content, (parsed.project ? ['project'] : ['tool', 'poetry']).concat('version'), this.version.toString()); @@ -88050,11 +89859,11 @@ class CargoLock { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { let payload = content; const parsed = (0, common_1.parseCargoLockfile)(payload); if (!parsed.package) { - logger_1.logger.error('is not a Cargo lockfile'); + logger.error('is not a Cargo lockfile'); throw new Error('is not a Cargo lockfile'); } // n.b for `replaceTomlString`, we need to keep track of the index @@ -88075,7 +89884,7 @@ class CargoLock { // which is lucky because `replaceTomlString` expect "all strings" in its // `path` argument. const packageIndex = i.toString(); - logger_1.logger.info(`updating ${pkg.name} in`); + logger.info(`updating ${pkg.name} in`); payload = (0, toml_edit_1.replaceTomlValue)(payload, ['package', packageIndex, 'version'], nextVersion.toString()); } return payload; @@ -88119,7 +89928,7 @@ class CargoToml extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { let payload = content; if (!this.versionsMap) { throw new Error('updateContent called with no versions'); @@ -88127,7 +89936,7 @@ class CargoToml extends default_1.DefaultUpdater { const parsed = (0, common_1.parseCargoManifest)(payload); if (!parsed.package) { const msg = 'is not a package manifest (might be a cargo workspace)'; - logger_1.logger.error(msg); + logger.error(msg); throw new Error(msg); } payload = (0, toml_edit_1.replaceTomlValue)(payload, ['package', 'version'], this.version.toString()); @@ -88142,14 +89951,14 @@ class CargoToml extends default_1.DefaultUpdater { } const dep = deps[pkgName]; if (typeof dep === 'string' || typeof dep.path === 'undefined') { - logger_1.logger.info(`skipping ${depKind}.${pkgName} (no path set)`); + logger.info(`skipping ${depKind}.${pkgName} (no path set)`); continue; // to next depKind } if (typeof dep.version === 'undefined') { - logger_1.logger.info(`skipping ${depKind}.${pkgName} (no version set)`); + logger.info(`skipping ${depKind}.${pkgName} (no version set)`); continue; // to next depKind } - logger_1.logger.info(`updating ${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`); + logger.info(`updating ${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`); payload = (0, toml_edit_1.replaceTomlValue)(payload, [depKind, pkgName, 'version'], pkgVersion.toString()); } // Update platform-specific dependencies @@ -88165,10 +89974,10 @@ class CargoToml extends default_1.DefaultUpdater { } const dep = deps[pkgName]; if (typeof dep === 'string' || typeof dep.path === 'undefined') { - logger_1.logger.info(`skipping target.${targetName}.${depKind}.${pkgName} in`); + logger.info(`skipping target.${targetName}.${depKind}.${pkgName} in`); continue; // to next depKind } - logger_1.logger.info(`updating target.${targetName}.${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`); + logger.info(`updating target.${targetName}.${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`); payload = (0, toml_edit_1.replaceTomlValue)(payload, ['target', targetName, depKind, pkgName, 'version'], pkgVersion.toString()); } } @@ -88255,10 +90064,10 @@ class ModuleVersion extends default_1.DefaultUpdater { * @param {string} content The initial content * @returns {string} The updated content */ - updateContent(content) { + updateContent(content, logger = logger_1.logger) { const oldVersion = content.match(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/); if (oldVersion) { - logger_1.logger.info(`updating from ${oldVersion} to v${this.version}`); + logger.info(`updating from ${oldVersion} to v${this.version}`); } return content.replace(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/g, `v${this.version}`); } @@ -88345,7 +90154,7 @@ function getAllResourceNames() { } class BranchName { constructor(_branchName) { } - static parse(branchName) { + static parse(branchName, logger = logger_1.logger) { try { const branchNameClass = getAllResourceNames().find(clazz => { return clazz.matches(branchName); @@ -88356,7 +90165,7 @@ class BranchName { return new branchNameClass(branchName); } catch (e) { - logger_1.logger.warn(`Error parsing branch name: ${branchName}`, e); + logger.warn(`Error parsing branch name: ${branchName}`, e); return undefined; } } @@ -88629,221 +90438,6 @@ exports.CommitSplit = CommitSplit; /***/ }), -/***/ 9405: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BranchFileCache = exports.RepositoryFileCache = exports.DEFAULT_FILE_MODE = void 0; -const logger_1 = __nccwpck_require__(68809); -const errors_1 = __nccwpck_require__(93637); -exports.DEFAULT_FILE_MODE = '100644'; -/** - * This class is a read-through cache aimed at minimizing the - * number of API requests needed to fetch file data/contents. - * It lazy-caches data as it reads and will return cached data - * for resources already fetched. - */ -class RepositoryFileCache { - /** - * Instantiate a new loading cache instance - * - * @param {Octokit} octokit An authenticated octokit instance - * @param {Repository} repository The repository we are fetching data for - */ - constructor(octokit, repository) { - this.octokit = octokit; - this.repository = repository; - this.cache = new Map(); - } - /** - * Fetch file contents for given path on a given branch. If the - * data has already been fetched, return a cached copy. - * - * @param {string} path Path to the file - * @param {string} branch Branch to fetch the file from - * @returns {GitHubFileContents} The file contents - */ - async getFileContents(path, branch) { - let fileCache = this.cache.get(branch); - if (!fileCache) { - fileCache = new BranchFileCache(this.octokit, this.repository, branch); - this.cache.set(branch, fileCache); - } - return await fileCache.getFileContents(path); - } -} -exports.RepositoryFileCache = RepositoryFileCache; -/** - * This class is a read-through cache for a single branch aimed - * at minimizing the number of API requests needed to fetch file - * data/contents. It lazy-caches data as it reads and will return - * cached data for resources already fetched. - */ -class BranchFileCache { - /** - * Instantiate a new loading cache instance - * - * @param {Octokit} octokit An authenticated octokit instance - * @param {Repository} repository The repository we are fetching data for - * @param {string} branch The branch we are fetching data from - */ - constructor(octokit, repository, branch) { - this.octokit = octokit; - this.repository = repository; - this.branch = branch; - this.cache = new Map(); - this.treeCache = new Map(); - } - /** - * Fetch file contents for given path. If the data has already been - * fetched, return the cached copy. - * - * @param {string} path Path to the file - * @param {string} branch Branch to fetch the file from - * @returns {GitHubFileContents} The file contents - */ - async getFileContents(path) { - const cached = this.cache.get(path); - if (cached) { - return cached; - } - const fetched = await this.fetchFileContents(path); - this.cache.set(path, fetched); - return fetched; - } - /** - * Actually fetch the file contents. Uses the tree API to fetch file - * data. - * - * @param {string} path Path to the file - */ - async fetchFileContents(path) { - // try to use the entire git tree if it's not too big - const treeEntries = await this.getFullTree(); - if (treeEntries) { - logger_1.logger.debug(`Using full tree to find ${path}`); - const found = treeEntries.find(entry => entry.path === path); - if (found === null || found === void 0 ? void 0 : found.sha) { - return await this.fetchContents(found.sha, found); - } - throw new errors_1.FileNotFoundError(path); - } - // full tree is too big, use data API to fetch - const parts = path.split('/'); - let treeSha = this.branch; - let found; - for (const part of parts) { - const tree = await this.getTree(treeSha); - found = tree.find(item => item.path === part); - if (!(found === null || found === void 0 ? void 0 : found.sha)) { - throw new errors_1.FileNotFoundError(path); - } - treeSha = found.sha; - } - if (found === null || found === void 0 ? void 0 : found.sha) { - return await this.fetchContents(found.sha, found); - } - throw new errors_1.FileNotFoundError(path); - } - /** - * Return the full recursive git tree. If already fetched, return - * the cached version. If the tree is too big, return null. - * - * @returns {TreeEntry[]} The tree entries - */ - async getFullTree() { - if (this.treeEntries === undefined) { - // fetch all tree entries recursively - const { data: { tree, truncated }, } = await this.octokit.git.getTree({ - owner: this.repository.owner, - repo: this.repository.repo, - tree_sha: this.branch, - recursive: 'true', - }); - if (truncated) { - // the full tree is too big to use, mark it as unusable - this.treeEntries = null; - } - else { - this.treeEntries = tree; - } - } - return this.treeEntries; - } - /** - * Returns the git tree for a given SHA. If already fetched, return - * the cached version. - * - * @param {string} sha The tree SHA - * @returns {TreeEntry[]} The tree entries - */ - async getTree(sha) { - const cached = this.treeCache.get(sha); - if (cached) { - return cached; - } - const fetched = await this.fetchTree(sha); - this.treeCache.set(sha, fetched); - return fetched; - } - /** - * Fetch the git tree via the GitHub API - * - * @param {string} sha The tree SHA - * @returns {TreeEntry[]} The tree entries - */ - async fetchTree(sha) { - const { data: { tree, truncated }, } = await this.octokit.git.getTree({ - owner: this.repository.owner, - repo: this.repository.repo, - tree_sha: sha, - }); - if (truncated) { - logger_1.logger.warn(`file list for tree sha ${sha} is truncated`); - } - return tree; - } - /** - * Fetch the git blob from the GitHub API and convert into a - * GitHubFileContents object. - * - * @param {string} blobSha The git blob SHA - * @param {TreeEntry} treeEntry The associated tree object - */ - async fetchContents(blobSha, treeEntry) { - const { data: { content }, } = await this.octokit.git.getBlob({ - owner: this.repository.owner, - repo: this.repository.repo, - file_sha: blobSha, - }); - return { - sha: blobSha, - mode: treeEntry.mode || exports.DEFAULT_FILE_MODE, - content, - parsedContent: Buffer.from(content, 'base64').toString('utf8'), - }; - } -} -exports.BranchFileCache = BranchFileCache; -//# sourceMappingURL=file-cache.js.map - -/***/ }), - /***/ 13170: /***/ ((__unused_webpack_module, exports) => { @@ -89015,17 +90609,17 @@ class PullRequestBody { this.releaseData = releaseData; this.useComponents = (_a = options === null || options === void 0 ? void 0 : options.useComponents) !== null && _a !== void 0 ? _a : this.releaseData.length > 1; } - static parse(body) { + static parse(body, logger = logger_1.logger) { const parts = splitBody(body); if (!parts) { - logger_1.logger.error('Pull request body did not match'); + logger.error('Pull request body did not match'); return undefined; } - let data = extractMultipleReleases(parts.content); + let data = extractMultipleReleases(parts.content, logger); if (data.length === 0) { - data = extractSingleRelease(parts.content); + data = extractSingleRelease(parts.content, logger); if (data.length === 0) { - logger_1.logger.warn('Failed to parse releases.'); + logger.warn('Failed to parse releases.'); } } return new PullRequestBody(data, { @@ -89078,7 +90672,7 @@ function splitBody(body) { } const SUMMARY_PATTERN = /^(?.*[^:]):? (?\d+\.\d+\.\d+.*)$/; const COMPONENTLESS_SUMMARY_PATTERN = /^(?\d+\.\d+\.\d+.*)$/; -function extractMultipleReleases(notes) { +function extractMultipleReleases(notes, logger) { const data = []; const root = (0, node_html_parser_1.parse)(notes); for (const detail of root.getElementsByTagName('details')) { @@ -89097,7 +90691,7 @@ function extractMultipleReleases(notes) { else { const componentlessMatch = summary.match(COMPONENTLESS_SUMMARY_PATTERN); if (!(componentlessMatch === null || componentlessMatch === void 0 ? void 0 : componentlessMatch.groups)) { - logger_1.logger.warn(`Summary: ${summary} did not match the expected pattern`); + logger.warn(`Summary: ${summary} did not match the expected pattern`); continue; } detail.removeChild(summaryNode); @@ -89111,13 +90705,13 @@ function extractMultipleReleases(notes) { return data; } const COMPARE_REGEX = /^#{2,} \[?(?\d+\.\d+\.\d+.*)\]?/; -function extractSingleRelease(body) { +function extractSingleRelease(body, logger) { var _a; body = body.trim(); const match = body.match(COMPARE_REGEX); const versionString = (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.version; if (!versionString) { - logger_1.logger.warn('Failed to find version in release notes'); + logger.warn('Failed to find version in release notes'); return []; } return [ @@ -89157,19 +90751,21 @@ const version_1 = __nccwpck_require__(17348); // at the script level are undefined, they are only defined inside function // or instance methods/properties. const DEFAULT_PR_TITLE_PATTERN = 'chore${scope}: release${component} ${version}'; -function generateMatchPattern(pullRequestTitlePattern) { +function generateMatchPattern(pullRequestTitlePattern, logger = logger_1.logger) { if (pullRequestTitlePattern && pullRequestTitlePattern.search(/\$\{scope\}/) === -1) - logger_1.logger.warn("pullRequestTitlePattern miss the part of '${scope}'"); + logger.warn("pullRequestTitlePattern miss the part of '${scope}'"); if (pullRequestTitlePattern && pullRequestTitlePattern.search(/\$\{component\}/) === -1) - logger_1.logger.warn("pullRequestTitlePattern miss the part of '${component}'"); + logger.warn("pullRequestTitlePattern miss the part of '${component}'"); if (pullRequestTitlePattern && pullRequestTitlePattern.search(/\$\{version\}/) === -1) - logger_1.logger.warn("pullRequestTitlePattern miss the part of '${version}'"); + logger.warn("pullRequestTitlePattern miss the part of '${version}'"); return new RegExp(`^${(pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN) .replace('[', '\\[') // TODO: handle all regex escaping .replace(']', '\\]') + .replace('(', '\\(') + .replace(')', '\\)') .replace('${scope}', '(\\((?[\\w-./]+)\\))?') .replace('${component}', ' ?(?[\\w-./]*)?') .replace('${version}', 'v?(?[0-9].*)') @@ -89183,10 +90779,10 @@ class PullRequestTitle { this.targetBranch = opts.targetBranch; this.pullRequestTitlePattern = opts.pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN; - this.matchPattern = generateMatchPattern(this.pullRequestTitlePattern); + this.matchPattern = generateMatchPattern(this.pullRequestTitlePattern, opts.logger); } - static parse(title, pullRequestTitlePattern) { - const matchPattern = generateMatchPattern(pullRequestTitlePattern); + static parse(title, pullRequestTitlePattern, logger = logger_1.logger) { + const matchPattern = generateMatchPattern(pullRequestTitlePattern, logger); const match = title.match(matchPattern); if (match === null || match === void 0 ? void 0 : match.groups) { return new PullRequestTitle({ @@ -89196,6 +90792,7 @@ class PullRequestTitle { component: match.groups['component'], targetBranch: match.groups['branch'], pullRequestTitlePattern, + logger, }); } return undefined; @@ -89629,8 +91226,10 @@ class DefaultVersioningStrategy { * 1.0.0, then bump the patch version for features */ constructor(options = {}) { + var _a; this.bumpMinorPreMajor = options.bumpMinorPreMajor === true; this.bumpPatchForMinorPreMajor = options.bumpPatchForMinorPreMajor === true; + this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : logger_1.logger; } /** * Given the current version of an artifact and a list of commits, @@ -89650,7 +91249,7 @@ class DefaultVersioningStrategy { const releaseAs = commit.notes.find(note => note.title === 'RELEASE AS'); if (releaseAs) { // commits are handled newest to oldest, so take the first one (newest) found - logger_1.logger.debug(`found Release-As: ${releaseAs.text}, forcing version`); + this.logger.debug(`found Release-As: ${releaseAs.text}, forcing version`); return new versioning_strategy_1.CustomVersionUpdate(version_1.Version.parse(releaseAs.text).toString()); } if (commit.breaking) { @@ -114412,7 +116011,7 @@ module.exports = {}; /***/ ((module) => { "use strict"; -module.exports = {"i8":"13.21.0"}; +module.exports = {"i8":"14.5.0"}; /***/ }),