diff --git a/.vscode/launch.json b/.vscode/launch.json index daffc92..43ac76a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -111,6 +111,16 @@ "args": ["extract-changelog", "--out"], "program": "${workspaceFolder}/bin.js" }, + { + "type": "pwa-node", + "request": "launch", + "name": "merge", + "skipFiles": [ + "/**" + ], + "args": ["merge", "--target", "main", "--source", "next", "--verbose", "--force", "--clean", "--changelog", "--compact"], + "program": "${workspaceFolder}/bin.js" + } { "type": "pwa-node", "request": "launch", diff --git a/lib/index.js b/lib/index.js index 4770839..01d3a86 100644 --- a/lib/index.js +++ b/lib/index.js @@ -71,15 +71,6 @@ function groupBy(f, xs){ return idx } -function getVersionFromReleasePR(x){ - return [x] - .filter(Boolean) - .map( x => x.title ) - .flatMap( x => x.split('-') ) - .map( x => x.trim() ) - .find( x => semver.valid(x)) -} - async function getPackageJSONVersion({ owner, repo }){ let f; try { f = await octokit.rest.repos.getContent( @@ -341,12 +332,7 @@ async function extractChangelog(options){ ,per_page: 2 ,page: 1 }) - } - - let openBranches = - lastRelease - ? await getRecentBranchesFromLastRelease({ owner, repo, lastRelease }) - : [] + } let lines = lastRelease @@ -416,7 +402,7 @@ async function extractChangelog(options){ // this version is the published version + branch inferred versions // it ignores the version set in the PR description let nextVersion = - await getNextVersion({ recentBranches: openBranches, version }) + await getNextVersion({ recentBranches, version }) let contributors = [...new Set(recentBranches.map( x => x.user.login))] @@ -737,11 +723,10 @@ async function merge(options){ return null; } -async function inferVersion({ owner, repo, lastRelease }){ +async function inferVersion({ owner, repo }){ let versionTypes = { git: await getGitTagVersion({ owner, repo }) ,npm: await getPackageJSONVersion({ owner, repo }) - ,title: lastRelease && getVersionFromReleasePR(lastRelease) ,default: '0.0.0' } diff --git a/package.json b/package.json index 573c0d3..d1f45dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pr-release", - "version": "0.18.4", + "version": "0.18.7", "description": "Generate releases from pull request descriptions.", "main": "dist/pr-release.cjs", "module": "lib/index.js",