From b6bca70dcd3e56e896605356ce09b76f7e1e0d39 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 10 Feb 2023 17:42:14 +0000 Subject: [PATCH] chore: Release 5.1.0 [skip ci] --- CHANGELOG.md | 7 +++++++ dist/index.js | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94cfb5d5e..d0db7e6f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/dist/index.js b/dist/index.js index d9eb24c58..25ae9be05 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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) { @@ -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); } @@ -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( ', ' )}.` ); @@ -37487,7 +37490,7 @@ module.exports = async function validatePrTitle( raiseError( `Disallowed ${ disallowedScopes.length === 1 ? 'scope was' : 'scopes were' - } found: ${disallowScopes.join(', ')}` + } found: ${disallowedScopes.join(', ')}` ); }