Skip to content

Fix regexes flags set incorrectly #3

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

Merged
merged 2 commits into from
Jan 5, 2021
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The action accepts some properties:
changelog-file-path: 'MyChangelog.md'
```

- `case-insensitive-regex` to make both `tag-regex` and `filter-regex` case insensitive, defaults to `true`.
- `case-insensitive-regex` to make both `tag-regex` and `filter-regex` case insensitive, defaults to `false`.

```
- name: Create Changelog
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ inputs:
default: 'CHANGELOG.md'
case-insensitive-regex:
description: 'If true both tag-regex and filter-regex are case insensitive'
default: true
default: false
9 changes: 6 additions & 3 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export interface Settings {
export async function initSettings(): Promise<Settings> {
const settings = {} as Settings
settings.gitPath = await io.which('git', true)
const caseInsensitive = core.getInput('case-insensitive-regex')
settings.tagRegex = RegExp(core.getInput('tag-regex'), caseInsensitive)
settings.filterRegex = RegExp(core.getInput('filter-regex'), caseInsensitive)
let regexFlag = ''
if (core.getInput('case-insensitive-regex') === 'true') {
regexFlag = 'i'
}
settings.tagRegex = RegExp(core.getInput('tag-regex'), regexFlag)
settings.filterRegex = RegExp(core.getInput('filter-regex'), regexFlag)
settings.changelogFilePath = core.getInput('changelog-file-path') || 'CHANGELOG.md'
return settings
}