Skip to content

Commit

Permalink
fix: prevent open release PRs from being mistaken as current releases (
Browse files Browse the repository at this point in the history
…#2323)

* docs: add compile step to local run command

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

---------

Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
stdavis and chingor13 authored Sep 11, 2024
1 parent 92abffb commit 3101ab3
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
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 @@ export class GitHub {
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
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

0 comments on commit 3101ab3

Please sign in to comment.