diff --git a/dist/index.js b/dist/index.js index 73cfaa7..5878af6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -81022,9 +81022,9 @@ class Manifest { github, ...config, }); - const component = await strategy.getComponent(); + const component = await strategy.getBranchComponent(); const releasedVersions = {}; - const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), config.includeComponentInTag ? component : '', config.pullRequestTitlePattern); + const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), component, config.pullRequestTitlePattern); if (latestVersion) { releasedVersions[path] = latestVersion; } @@ -81481,20 +81481,16 @@ class Manifest { } } async createReleasesForPullRequest(releases, pullRequest) { - // create the release - const promises = []; - for (const release of releases) { - promises.push(this.createRelease(release)); - } + logger_1.logger.info(`Creating ${releases.length} releases for pull #${pullRequest.number}`); const duplicateReleases = []; const githubReleases = []; - for (const promise of promises) { + for (const release of releases) { try { - githubReleases.push(await promise); + githubReleases.push(await this.createRelease(release)); } catch (err) { if (err instanceof errors_1.DuplicateReleaseError) { - logger_1.logger.warn(`Duplicate release tag: ${err.tag}`); + logger_1.logger.warn(`Duplicate release tag: ${release.tag.toString()}`); duplicateReleases.push(err); } else { @@ -81502,14 +81498,28 @@ class Manifest { } } } - if (duplicateReleases.length > 0 && githubReleases.length === 0) { - throw duplicateReleases[0]; + if (duplicateReleases.length > 0) { + if (duplicateReleases.length + githubReleases.length === + releases.length) { + // we've either tagged all releases or they were duplicates: + // adjust tags on pullRequest + await Promise.all([ + this.github.removeIssueLabels(this.labels, pullRequest.number), + this.github.addIssueLabels(this.releaseLabels, pullRequest.number), + ]); + } + if (githubReleases.length === 0) { + // If all releases were duplicate, throw a duplicate error + throw duplicateReleases[0]; + } + } + else { + // adjust tags on pullRequest + await Promise.all([ + this.github.removeIssueLabels(this.labels, pullRequest.number), + this.github.addIssueLabels(this.releaseLabels, pullRequest.number), + ]); } - // adjust tags on pullRequest - await Promise.all([ - this.github.removeIssueLabels(this.labels, pullRequest.number), - this.github.addIssueLabels(this.releaseLabels, pullRequest.number), - ]); return githubReleases; } async createRelease(release) { @@ -87680,6 +87690,12 @@ class ComponentBranchName extends BranchName { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CommitSplit = void 0; const manifest_1 = __nccwpck_require__(31999); +/** + * Helper class for splitting commits by component path. If `packagePaths` + * is configured, then only consider the provided paths. If `includeEmpty` + * is configured, then commits without any touched files apply to all + * configured component paths. + */ class CommitSplit { constructor(opts) { opts = opts || {}; @@ -87715,7 +87731,15 @@ class CommitSplit { this.packagePaths = paths; } } - // split(commits: Commit[]): Record + /** + * Split commits by component path. If the commit splitter is configured + * with a set of tracked package paths, then only consider paths for + * configured components. If `includeEmpty` is configured, then a commit + * that does not touch any files will be applied to all components' + * commits. + * @param {Commit[]} commits The commits to split + * @returns {Record} Commits indexed by component path + */ split(commits) { const splitCommits = {}; commits.forEach(commit => { @@ -87750,8 +87774,16 @@ class CommitSplit { splitCommits[pkgName].push(commit); } if (commit.files.length === 0 && this.includeEmpty) { - for (const pkgName in splitCommits) { - splitCommits[pkgName].push(commit); + if (this.packagePaths) { + for (const pkgName of this.packagePaths) { + splitCommits[pkgName] = splitCommits[pkgName] || []; + splitCommits[pkgName].push(commit); + } + } + else { + for (const pkgName in splitCommits) { + splitCommits[pkgName].push(commit); + } } } }); @@ -113542,7 +113574,7 @@ module.exports = {}; /***/ ((module) => { "use strict"; -module.exports = {"i8":"13.16.3"}; +module.exports = {"i8":"13.16.4"}; /***/ }),