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

Add publish input #88

Merged
merged 1 commit into from
Apr 28, 2023
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 @@ -44,6 +44,7 @@ jobs:
| `notes-header` | `string` | The header to use for the release notes. |
| `notes-footer` | `string` | The footer to use for the release notes. |
| `variables` | `list` | A list of variables to use in the header and footer. |
| `publish` | `boolean` | Whether to publish the release. (default `false`) |

## Outputs

Expand Down
2 changes: 2 additions & 0 deletions __tests__/notes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('generateReleaseNotes', () => {
footer: 'footer with version {{version}} and baz {{baz}}',
variables: ['foo=bar', 'baz=qux'],
collapseAfter: 0,
publish: false,
}
const releaseData = {
releases: [],
Expand Down Expand Up @@ -117,6 +118,7 @@ describe('generateReleaseNotes', () => {
footer: 'footer with version {{version}}',
variables: [],
collapseAfter: 3,
publish: false,
}

const releaseData = {
Expand Down
1 change: 1 addition & 0 deletions __tests__/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ describe('createOrUpdateRelease', () => {
footer: 'footer',
variables: [],
collapseAfter: 0,
publish: false,
}
beforeEach(() => {
jest.clearAllMocks()
Expand Down
1 change: 1 addition & 0 deletions __tests__/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('getVersionIncrease', () => {
footer: '',
variables: [],
collapseAfter: 0,
publish: false,
}

const releaseData = {
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ inputs:
description: 'Number of lines required for the section to be collapsed'
default: '0'
required: false
publish:
description: 'Whether to publish the release'
default: 'false'
required: false
outputs:
version:
description: 'The version of the release'
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface Inputs {
footer: string
variables: string[]
collapseAfter: number
publish: boolean
}

export function getInputs(): Inputs {
Expand All @@ -20,5 +21,6 @@ export function getInputs(): Inputs {
footer: core.getInput('notes-footer'),
variables: Util.getInputList('variables'),
collapseAfter: parseInt(core.getInput('collapse-after'), 10),
publish: core.getBooleanInput('publish'),
}
}
2 changes: 1 addition & 1 deletion src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function createOrUpdateRelease(
return
}

const draft = releaseData.branch !== 'tag'
const draft = releaseData.branch !== 'tag' || !inputs.publish
releaseData.branch = (releaseData.branch === 'tag' && releaseDraft?.target_commitish) || releaseData.branch
core.debug(`releaseData.branch: ${releaseData.branch}`)
const newReleaseNotes = await generateReleaseNotes(client, inputs, releaseData)
Expand Down