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

feat: adds pull-request-header setting #615

Merged
merged 2 commits into from
Dec 8, 2022
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Automate releases with Conventional Commit Messages.
| `command` | release-please command to run, either `github-release`, or `release-pr`, `manifest`, `manifest-pr` (_defaults to running both_) |
| `default-branch` | branch to open pull release PR against (detected by default) |
| `pull-request-title-pattern` | title pattern used to make release PR, defaults to using `chore${scope}: release${component} ${version}`. |
| `pull-request-header` | header used within the release PR body, defaults to using `:robot: I have created a release *beep* *boop*`. |
| `changelog-path` | configure alternate path for `CHANGELOG.md`. Default `CHANGELOG.md` |
| `github-api-url` | configure github API URL. Default `https://api.github.com` |
| `signoff` | Add [`Signed-off-by`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) line at the end of the commit log message using the user and email provided. (format "Name \<[email protected]\>") |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ inputs:
pull-request-title-pattern:
description: 'add title pattern to make release PR, defaults to using "chore${scope}: release${component} ${version}"'
required: false
pull-request-header:
description: 'set release PR header, defaults to using ":robot: I have created a release *beep* *boop*"'
required: false
draft:
description: 'mark release as a draft'
required: false
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ async function manifestInstance (github) {
const versionFile = core.getInput('version-file') || undefined
const extraFiles = core.getMultilineInput('extra-files') || undefined
const pullRequestTitlePattern = core.getInput('pull-request-title-pattern') || undefined
const pullRequestHeader = core.getInput('pull-request-header') || undefined
const draft = getOptionalBooleanInput('draft')
const draftPullRequest = getOptionalBooleanInput('draft-pull-request')
const changelogType = core.getInput('changelog-notes-type') || undefined
Expand Down Expand Up @@ -179,6 +180,7 @@ async function manifestInstance (github) {
extraFiles,
includeComponentInTag: monorepoTags,
pullRequestTitlePattern,
pullRequestHeader,
draftPullRequest,
versioning,
releaseAs,
Expand Down
33 changes: 33 additions & 0 deletions test/release-please.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,39 @@ describe('release-please-action', () => {
)
})

it('opens PR with custom header', async () => {
input = {
command: 'release-pr',
'release-type': 'node',
'pull-request-header': 'another header',
'skip-github-release': 'false',
prerelease: 'false',
'include-v-in-tag': 'true',
'always-link-local': 'true',
'separate-pull-requests': 'false',
'skip-labeling': 'false',
'sequential-calls': 'false'
}

const createPullRequestsFake = sandbox.fake.returns([fixturePrs[0]])
const createManifestCommand = sandbox.stub(Manifest, 'fromConfig').returns({
createPullRequests: createPullRequestsFake
})
await action.main()

sinon.assert.calledOnce(createPullRequestsFake)
sinon.assert.calledWith(
createManifestCommand,
sinon.match.any,
'main',
sinon.match.hasOwn(
'pullRequestHeader',
'another header'
),
sinon.match.any
)
})

it('both opens PR to the default branch and tags GitHub releases by default', async () => {
input = {
'skip-github-release': 'false',
Expand Down