release-please 16.3.0 → 16.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,6 +6,7 @@ export interface VersioningStrategyFactoryOptions {
|
|
|
6
6
|
bumpMinorPreMajor?: boolean;
|
|
7
7
|
bumpPatchForMinorPreMajor?: boolean;
|
|
8
8
|
prereleaseType?: string;
|
|
9
|
+
prerelease?: boolean;
|
|
9
10
|
github: GitHub;
|
|
10
11
|
}
|
|
11
12
|
export type VersioningStrategyBuilder = (options: VersioningStrategyFactoryOptions) => VersioningStrategy;
|
package/build/src/factory.js
CHANGED
|
@@ -110,6 +110,7 @@ async function buildStrategy(options) {
|
|
|
110
110
|
bumpMinorPreMajor: options.bumpMinorPreMajor,
|
|
111
111
|
bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
|
|
112
112
|
prereleaseType: options.prereleaseType,
|
|
113
|
+
prerelease: options.prerelease,
|
|
113
114
|
});
|
|
114
115
|
const changelogNotes = (0, changelog_notes_factory_1.buildChangelogNotes)({
|
|
115
116
|
type: options.changelogType || 'default',
|
package/build/src/github.js
CHANGED
|
@@ -508,7 +508,8 @@ class GitHub {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
async mergeCommitsGraphQL(targetBranch, cursor, options = {}) {
|
|
511
|
-
var _a, _b, _c, _d;
|
|
511
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
512
|
+
var _h;
|
|
512
513
|
this.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
|
|
513
514
|
const query = `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) {
|
|
514
515
|
repository(owner: $owner, name: $repo) {
|
|
@@ -579,17 +580,38 @@ class GitHub {
|
|
|
579
580
|
}
|
|
580
581
|
const history = response.repository.ref.target.history;
|
|
581
582
|
const commits = (history.nodes || []);
|
|
583
|
+
// Count the number of pull requests associated with each merge commit. This is
|
|
584
|
+
// used in the next step to make sure we only find pull requests with a
|
|
585
|
+
// merge commit that contain 1 merged commit.
|
|
586
|
+
const mergeCommitCount = {};
|
|
587
|
+
for (const commit of commits) {
|
|
588
|
+
for (const pr of commit.associatedPullRequests.nodes) {
|
|
589
|
+
if ((_b = pr.mergeCommit) === null || _b === void 0 ? void 0 : _b.oid) {
|
|
590
|
+
(_c = mergeCommitCount[_h = pr.mergeCommit.oid]) !== null && _c !== void 0 ? _c : (mergeCommitCount[_h] = 0);
|
|
591
|
+
mergeCommitCount[pr.mergeCommit.oid]++;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
582
595
|
const commitData = [];
|
|
583
596
|
for (const graphCommit of commits) {
|
|
584
597
|
const commit = {
|
|
585
598
|
sha: graphCommit.sha,
|
|
586
599
|
message: graphCommit.message,
|
|
587
600
|
};
|
|
588
|
-
const
|
|
589
|
-
return
|
|
601
|
+
const mergePullRequest = graphCommit.associatedPullRequests.nodes.find(pr => {
|
|
602
|
+
return (
|
|
603
|
+
// Only match the pull request with a merge commit if there is a
|
|
604
|
+
// single merged commit in the PR. This means merge commits and squash
|
|
605
|
+
// merges will be matched, but rebase merged PRs will only be matched
|
|
606
|
+
// if they contain a single commit. This is so PRs that are rebased
|
|
607
|
+
// and merged will have ßSfiles backfilled from each commit instead of
|
|
608
|
+
// the whole PR.
|
|
609
|
+
pr.mergeCommit &&
|
|
610
|
+
pr.mergeCommit.oid === graphCommit.sha &&
|
|
611
|
+
mergeCommitCount[pr.mergeCommit.oid] === 1);
|
|
590
612
|
});
|
|
613
|
+
const pullRequest = mergePullRequest || graphCommit.associatedPullRequests.nodes[0];
|
|
591
614
|
if (pullRequest) {
|
|
592
|
-
const files = (((_b = pullRequest.files) === null || _b === void 0 ? void 0 : _b.nodes) || []).map(node => node.path);
|
|
593
615
|
commit.pullRequest = {
|
|
594
616
|
sha: commit.sha,
|
|
595
617
|
number: pullRequest.number,
|
|
@@ -598,16 +620,19 @@ class GitHub {
|
|
|
598
620
|
title: pullRequest.title,
|
|
599
621
|
body: pullRequest.body,
|
|
600
622
|
labels: pullRequest.labels.nodes.map(node => node.name),
|
|
601
|
-
files,
|
|
623
|
+
files: (((_d = pullRequest.files) === null || _d === void 0 ? void 0 : _d.nodes) || []).map(node => node.path),
|
|
602
624
|
};
|
|
603
|
-
|
|
604
|
-
|
|
625
|
+
}
|
|
626
|
+
if (mergePullRequest) {
|
|
627
|
+
if (((_f = (_e = mergePullRequest.files) === null || _e === void 0 ? void 0 : _e.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage) &&
|
|
628
|
+
options.backfillFiles) {
|
|
629
|
+
this.logger.info(`PR #${mergePullRequest.number} has many files, backfilling`);
|
|
605
630
|
commit.files = await this.getCommitFiles(graphCommit.sha);
|
|
606
631
|
}
|
|
607
632
|
else {
|
|
608
633
|
// We cannot directly fetch files on commits via graphql, only provide file
|
|
609
634
|
// information for commits with associated pull requests
|
|
610
|
-
commit.files = files;
|
|
635
|
+
commit.files = (((_g = mergePullRequest.files) === null || _g === void 0 ? void 0 : _g.nodes) || []).map(node => node.path);
|
|
611
636
|
}
|
|
612
637
|
}
|
|
613
638
|
else if (options.backfillFiles) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "16.3.
|
|
3
|
+
"version": "16.3.1",
|
|
4
4
|
"description": "generate release PRs based on the conventionalcommits.org spec",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": "./build/src/bin/release-please.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/jsonpath": "^0.2.0",
|
|
48
48
|
"@types/mocha": "^9.0.0",
|
|
49
49
|
"@types/node": "^18.0.0",
|
|
50
|
-
"@types/npmlog": "^
|
|
50
|
+
"@types/npmlog": "^7.0.0",
|
|
51
51
|
"@types/pino": "^7.0.0",
|
|
52
52
|
"@types/semver": "^7.0.0",
|
|
53
53
|
"@types/sinon": "^10.0.0",
|