Skip to content

Commit

Permalink
chore: Release 5.1.0 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
semantic-release-bot committed Feb 10, 2023
1 parent 403a6f8 commit b6bca70
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [5.1.0](https://github.com/amannn/action-semantic-pull-request/compare/v5.0.2...v5.1.0) (2023-02-10)


### Features

* Add regex support to `scope` and `disallowScopes` configuration ([#226](https://github.com/amannn/action-semantic-pull-request/issues/226)) ([403a6f8](https://github.com/amannn/action-semantic-pull-request/commit/403a6f89242a0d0d3acde94e6141b2e0f4da8838))

### [5.0.2](https://github.com/amannn/action-semantic-pull-request/compare/v5.0.1...v5.0.2) (2022-10-17)


Expand Down
13 changes: 8 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37430,11 +37430,14 @@ module.exports = async function validatePrTitle(
}

function isUnknownScope(s) {
return scopes && !scopes.includes(s);
return scopes && !scopes.some((scope) => new RegExp(`^${scope}$`).test(s));
}

function isDisallowedScope(s) {
return disallowScopes && disallowScopes.includes(s);
return (
disallowScopes &&
disallowScopes.some((scope) => new RegExp(`^${scope}$`).test(s))
);
}

if (!result.type) {
Expand All @@ -37458,7 +37461,7 @@ module.exports = async function validatePrTitle(
if (requireScope && !result.scope) {
let message = `No scope found in pull request title "${prTitle}".`;
if (scopes) {
message += ` Use one of the available scopes: ${scopes.join(', ')}.`;
message += ` Scope must match one of: ${scopes.join(', ')}.`;
}
raiseError(message);
}
Expand All @@ -37474,7 +37477,7 @@ module.exports = async function validatePrTitle(
unknownScopes.length > 1 ? 'scopes' : 'scope'
} "${unknownScopes.join(
','
)}" found in pull request title "${prTitle}". Use one of the available scopes: ${scopes.join(
)}" found in pull request title "${prTitle}". Scope must match one of: ${scopes.join(
', '
)}.`
);
Expand All @@ -37487,7 +37490,7 @@ module.exports = async function validatePrTitle(
raiseError(
`Disallowed ${
disallowedScopes.length === 1 ? 'scope was' : 'scopes were'
} found: ${disallowScopes.join(', ')}`
} found: ${disallowedScopes.join(', ')}`
);
}

Expand Down

0 comments on commit b6bca70

Please sign in to comment.