diff --git a/CHANGELOG.md b/CHANGELOG.md index 26ebfc2a7..f13678a21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [4.4.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.3.0...v4.4.0) (2022-04-22) + + +### Features + +* Add options to pass custom regex to conventional-commits-parser ([#177](https://github.com/amannn/action-semantic-pull-request/issues/177)) ([956659a](https://github.com/amannn/action-semantic-pull-request/commit/956659ae00eaa0b00fe5a58dfdf3a3db1efd1d63)) + ## [4.3.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.2.0...v4.3.0) (2022-04-13) diff --git a/dist/index.js b/dist/index.js index 4be448b02..d360c803c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35660,6 +35660,8 @@ module.exports = async function run() { wip, subjectPattern, subjectPatternError, + headerPattern, + headerPatternCorrespondence, validateSingleCommit, validateSingleCommitMatchesPrTitle, githubBaseUrl, @@ -35714,7 +35716,9 @@ module.exports = async function run() { scopes, requireScope, subjectPattern, - subjectPatternError + subjectPatternError, + headerPattern, + headerPatternCorrespondence }); if (validateSingleCommit) { @@ -35753,7 +35757,9 @@ module.exports = async function run() { scopes, requireScope, subjectPattern, - subjectPatternError + subjectPatternError, + headerPattern, + headerPatternCorrespondence }); } catch (error) { throw new Error( @@ -35844,6 +35850,18 @@ module.exports = function parseConfig() { ); } + let headerPattern; + if (process.env.INPUT_HEADERPATTERN) { + headerPattern = ConfigParser.parseString(process.env.INPUT_HEADERPATTERN); + } + + let headerPatternCorrespondence; + if (process.env.INPUT_HEADERPATTERNCORRESPONDENCE) { + headerPatternCorrespondence = ConfigParser.parseString( + process.env.INPUT_HEADERPATTERNCORRESPONDENCE + ); + } + let wip; if (process.env.INPUT_WIP) { wip = ConfigParser.parseBoolean(process.env.INPUT_WIP); @@ -35880,6 +35898,8 @@ module.exports = function parseConfig() { wip, subjectPattern, subjectPatternError, + headerPattern, + headerPatternCorrespondence, validateSingleCommit, validateSingleCommitMatchesPrTitle, githubBaseUrl, @@ -35902,11 +35922,25 @@ const defaultTypes = Object.keys(conventionalCommitTypes.types); module.exports = async function validatePrTitle( prTitle, - {types, scopes, requireScope, subjectPattern, subjectPatternError} = {} + { + types, + scopes, + requireScope, + subjectPattern, + subjectPatternError, + headerPattern, + headerPatternCorrespondence + } = {} ) { if (!types) types = defaultTypes; const {parserOpts} = await conventionalCommitsConfig(); + if (headerPattern) { + parserOpts.headerPattern = headerPattern; + } + if (headerPatternCorrespondence) { + parserOpts.headerCorrespondence = headerPatternCorrespondence; + } const result = parser(prTitle, parserOpts); function printAvailableTypes() {