Skip to content

Commit

Permalink
chore: Release 4.5.0 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
semantic-release-bot committed May 4, 2022
1 parent 6a7ed2d commit 91682d0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [4.5.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.4.0...v4.5.0) (2022-05-04)


### Features

* Add `disallowScopes` option ([#179](https://github.com/amannn/action-semantic-pull-request/issues/179)) ([6a7ed2d](https://github.com/amannn/action-semantic-pull-request/commit/6a7ed2d5046cf8a40c60494c83c962343061874a))

## [4.4.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.3.0...v4.4.0) (2022-04-22)


Expand Down
26 changes: 26 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35657,6 +35657,7 @@ module.exports = async function run() {
types,
scopes,
requireScope,
disallowScopes,
wip,
subjectPattern,
subjectPatternError,
Expand Down Expand Up @@ -35715,6 +35716,7 @@ module.exports = async function run() {
types,
scopes,
requireScope,
disallowScopes,
subjectPattern,
subjectPatternError,
headerPattern,
Expand Down Expand Up @@ -35756,6 +35758,7 @@ module.exports = async function run() {
types,
scopes,
requireScope,
disallowScopes,
subjectPattern,
subjectPatternError,
headerPattern,
Expand Down Expand Up @@ -35838,6 +35841,11 @@ module.exports = function parseConfig() {
requireScope = ConfigParser.parseBoolean(process.env.INPUT_REQUIRESCOPE);
}

let disallowScopes;
if (process.env.INPUT_DISALLOWSCOPES) {
disallowScopes = ConfigParser.parseEnum(process.env.INPUT_DISALLOWSCOPES);
}

let subjectPattern;
if (process.env.INPUT_SUBJECTPATTERN) {
subjectPattern = ConfigParser.parseString(process.env.INPUT_SUBJECTPATTERN);
Expand Down Expand Up @@ -35895,6 +35903,7 @@ module.exports = function parseConfig() {
types,
scopes,
requireScope,
disallowScopes,
wip,
subjectPattern,
subjectPatternError,
Expand Down Expand Up @@ -35926,6 +35935,7 @@ module.exports = async function validatePrTitle(
types,
scopes,
requireScope,
disallowScopes,
subjectPattern,
subjectPatternError,
headerPattern,
Expand Down Expand Up @@ -35961,6 +35971,10 @@ module.exports = async function validatePrTitle(
return scopes && !scopes.includes(s);
}

function isDisallowedScope(s) {
return disallowScopes && disallowScopes.includes(s);
}

if (!result.type) {
throw new Error(
`No release type found in pull request title "${prTitle}". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/\n\n${printAvailableTypes()}`
Expand Down Expand Up @@ -35991,6 +36005,7 @@ module.exports = async function validatePrTitle(
const givenScopes = result.scope
? result.scope.split(',').map((scope) => scope.trim())
: undefined;

const unknownScopes = givenScopes ? givenScopes.filter(isUnknownScope) : [];
if (scopes && unknownScopes.length > 0) {
throw new Error(
Expand All @@ -36004,6 +36019,17 @@ module.exports = async function validatePrTitle(
);
}

const disallowedScopes = givenScopes
? givenScopes.filter(isDisallowedScope)
: [];
if (disallowScopes && disallowedScopes.length > 0) {
throw new Error(
`Disallowed ${
disallowedScopes.length === 1 ? 'scope was' : 'scopes were'
} found: ${disallowScopes.join(', ')}`
);
}

function throwSubjectPatternError(message) {
if (subjectPatternError) {
message = formatMessage(subjectPatternError, {
Expand Down

0 comments on commit 91682d0

Please sign in to comment.