Skip to content

Commit

Permalink
fix: provide pull request to commit parser allow overrides (googleapi…
Browse files Browse the repository at this point in the history
…s#1285)

* test: failing e2e test for commit override

* fix: provide pull request to commit parser
  • Loading branch information
chingor13 committed Feb 8, 2022
1 parent f931842 commit e54028b
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
16 changes: 16 additions & 0 deletions __snapshots__/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ exports['Manifest buildPullRequests should allow customizing pull request title
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
`

exports['Manifest buildPullRequests should allow overriding commit message 1'] = `
:robot: I have created a release *beep* *boop*
---
### [1.0.1](https://github.com/fake-owner/fake-repo/compare/v1.0.0...v1.0.1) (1983-10-10)
### Bug Fixes
* real fix message ([def456](https://github.com/fake-owner/fake-repo/commit/def456))
---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
`

exports['Manifest buildPullRequests should handle multiple package repository 1'] = `
:robot: I have created a release *beep* *boop*
---
Expand Down
1 change: 1 addition & 0 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ export class Manifest {
sha: commit.sha,
message: commit.message,
files: commit.files,
pullRequest: commit.pullRequest,
});
}

Expand Down
62 changes: 62 additions & 0 deletions test/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
stubSuggesterWithSnapshot,
assertHasUpdate,
dateSafe,
safeSnapshot,
} from './helpers';
import {expect} from 'chai';
import {Version} from '../src/version';
Expand Down Expand Up @@ -1775,6 +1776,67 @@ describe('Manifest', () => {
]);
});

it('should allow overriding commit message', async () => {
mockReleases(github, [
{
sha: 'abc123',
tagName: 'v1.0.0',
url: 'https://github.com/fake-owner/fake-repo/releases/tag/v1.0.0',
},
]);
mockCommits(github, [
{
sha: 'def456',
message: 'fix: some bugfix',
files: [],
pullRequest: {
headBranchName: 'fix-1',
baseBranchName: 'main',
number: 123,
title: 'fix: some bugfix',
body: 'BEGIN_COMMIT_OVERRIDE\nfix: real fix message\nEND_COMMIT_OVERRIDE',
labels: [],
files: [],
sha: 'abc123',
},
},
{
sha: 'abc123',
message: 'chore: release 1.0.0',
files: [],
pullRequest: {
headBranchName: 'release-please/branches/main',
baseBranchName: 'main',
number: 123,
title: 'chore: release 1.0.0',
body: '',
labels: [],
files: [],
sha: 'abc123',
},
},
]);
const manifest = new Manifest(
github,
'main',
{
'.': {
releaseType: 'simple',
},
},
{
'.': Version.parse('1.0.0'),
},
{
draftPullRequest: true,
}
);
const pullRequests = await manifest.buildPullRequests();
expect(pullRequests).lengthOf(1);
const pullRequest = pullRequests[0];
safeSnapshot(pullRequest.body.toString());
});

describe('with plugins', () => {
beforeEach(() => {
mockReleases(github, [
Expand Down

0 comments on commit e54028b

Please sign in to comment.