Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent open release PRs from being mistaken as current releases #2323

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ accept your pull requests.
The below command should be run from the root of the source code:

```
node build/src/bin/release-please.js release-pr \
npm run compile && node build/src/bin/release-please.js release-pr \
--token=$GITHUB_TOKEN \
--repo-url=<owner>/<repo> [extra options]
```
Expand Down
29 changes: 29 additions & 0 deletions __snapshots__/github.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
number: pullRequest.number,
baseBranchName: pullRequest.baseRefName,
headBranchName: pullRequest.headRefName,
mergeCommitOid: pullRequest.mergeCommit?.oid,
title: pullRequest.title,
body: pullRequest.body,
labels: pullRequest.labels.nodes.map(node => node.name),
Expand Down Expand Up @@ -566,7 +567,7 @@
}
)) {
// Paginate plugin doesn't have types for listing files on a commit
const data = resp.data as any as {files: {filename: string}[]};

Check warning on line 570 in src/github.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
for (const f of data.files || []) {
if (f.filename) {
files.push(f.filename);
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ async function latestReleaseVersion(
for await (const commitWithPullRequest of generator) {
commitShas.add(commitWithPullRequest.sha);
const mergedPullRequest = commitWithPullRequest.pullRequest;
if (!mergedPullRequest) {
if (!mergedPullRequest?.mergeCommitOid) {
logger.trace(
`skipping commit: ${commitWithPullRequest.sha} missing merged pull request`
);
Expand Down
1 change: 1 addition & 0 deletions src/pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface PullRequest {
readonly headBranchName: string;
readonly baseBranchName: string;
readonly number: number;
readonly mergeCommitOid?: string;
readonly title: string;
readonly body: string;
readonly labels: string[];
Expand Down
1 change: 1 addition & 0 deletions test/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ describe('Manifest', () => {
title: 'chore: release 1.2.3',
headBranchName: 'release-please/branches/main',
baseBranchName: 'main',
mergeCommitOid: 'abc123',
number: 123,
body: '',
labels: [],
Expand Down
Loading