Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
feat: add pull-request-header input (#615)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
plaflamme and chingor13 authored Dec 8, 2022
1 parent 7a173c3 commit 9963ea2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
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@example.com\>") |
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

0 comments on commit 9963ea2

Please sign in to comment.