release-please
Advanced tools
Comparing version 14.1.0 to 14.1.1
@@ -141,9 +141,31 @@ import { PullRequest } from './pull-request'; | ||
* | ||
* @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 | ||
*/ | ||
pullRequestIterator(targetBranch: string, status?: 'OPEN' | 'CLOSED' | 'MERGED', maxResults?: number): AsyncGenerator<PullRequest, void, unknown>; | ||
pullRequestIterator(targetBranch: string, status?: 'OPEN' | 'CLOSED' | 'MERGED', maxResults?: number, includeFiles?: boolean): AsyncGenerator<PullRequest, void, void>; | ||
/** | ||
* 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 | ||
*/ | ||
private pullRequestIteratorWithFiles; | ||
/** | ||
* 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 | ||
*/ | ||
private pullRequestIteratorWithoutFiles; | ||
/** | ||
* Return a list of merged pull requests. The list is not guaranteed to be sorted | ||
@@ -150,0 +172,0 @@ * by merged_at, but is generally most recent first. |
@@ -571,8 +571,28 @@ "use strict"; | ||
* | ||
* @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; | ||
@@ -597,2 +617,48 @@ let results = 0; | ||
/** | ||
* 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 `merge_commit_sha` | ||
if (status !== 'MERGED' || pull.merge_commit_sha) { | ||
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 | ||
@@ -599,0 +665,0 @@ * by merged_at, but is generally most recent first. |
@@ -447,3 +447,3 @@ "use strict"; | ||
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) { | ||
@@ -463,3 +463,3 @@ if ((hasAllLabels(this.labels, openPullRequest.labels) || | ||
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) { | ||
@@ -523,3 +523,3 @@ if (hasAllLabels([exports.SNOOZE_LABEL], closedPullRequest.labels) && | ||
// 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) { | ||
@@ -526,0 +526,0 @@ if (!hasAllLabels(this.labels, pullRequest.labels)) { |
{ | ||
"name": "release-please", | ||
"version": "14.1.0", | ||
"version": "14.1.1", | ||
"description": "generate release PRs based on the conventionalcommits.org spec", | ||
@@ -5,0 +5,0 @@ "main": "./build/src/index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
745020
13848