Skip to content

Commit d26d794

Browse files
committed
feat: optionally ignore commits matching regexp
1 parent 6558ad5 commit d26d794

File tree

4 files changed

+35
-37
lines changed

4 files changed

+35
-37
lines changed

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ inputs:
1313
description: 'If it should be a draft in GitHub or an actual release'
1414
default: 'true'
1515
ignoreTagPattern:
16+
description: |
17+
Regular expression. Any tag matching it will be ignored.
18+
required: false
19+
default: ''
20+
ignorePattern:
1621
description: |
1722
Regular expression. Any commit matching it will be ignored.
1823
required: true

dist/index.js

Lines changed: 14 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ export async function run(): Promise<void> {
4141
console.log(`Using template:\n\n${template}\n\n`)
4242

4343
const ignoreTagPattern = core.getInput('ignoreTagPattern').trim()
44-
console.log(`Ignoring commits with pattern: '${ignoreTagPattern}'`)
44+
console.log(`Ignoring tags with pattern: '${ignoreTagPattern}'`)
45+
46+
const ignorePattern = core.getInput('ignorePattern').trim()
47+
console.log(`Ignoring commits with pattern: '${ignorePattern}'`)
4548

4649
const patchVersionPattern = core.getInput('patchVersionPattern').trim()
4750
console.log(`Stepping patch with pattern: '${patchVersionPattern}'`)
@@ -89,23 +92,17 @@ export async function run(): Promise<void> {
8992
currentVersion = '0.0.1'
9093
}
9194

92-
let description = draft
93-
? gitChangelogCommandLine([
94-
'-std',
95-
'--ignore-tag-pattern',
96-
ignoreTagPattern,
97-
'--template-content',
98-
template
99-
])
100-
: gitChangelogCommandLine([
101-
'-std',
102-
'--ignore-tag-pattern',
103-
ignoreTagPattern,
104-
'--to-revision',
105-
currentVersion,
106-
'--template-content',
107-
template
108-
])
95+
let args = ['-std', '--template-content', template]
96+
if (!draft) {
97+
args = [...args, '--to-revision', currentVersion]
98+
}
99+
if (ignoreTagPattern !== '') {
100+
args = [...args, '--ignore-tag-pattern', ignoreTagPattern]
101+
}
102+
if (ignorePattern !== '') {
103+
args = [...args, '--ignore-pattern', ignorePattern]
104+
}
105+
let description = gitChangelogCommandLine(args)
109106
console.log(
110107
`Rendered '${currentVersion}' description:\n\n${description}\n\n`
111108
)

0 commit comments

Comments
 (0)