Skip to content

Commit 91682d0

Browse files
chore: Release 4.5.0 [skip ci]
1 parent 6a7ed2d commit 91682d0

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [4.5.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.4.0...v4.5.0) (2022-05-04)
4+
5+
6+
### Features
7+
8+
* 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))
9+
310
## [4.4.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.3.0...v4.4.0) (2022-04-22)
411

512

dist/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35657,6 +35657,7 @@ module.exports = async function run() {
3565735657
types,
3565835658
scopes,
3565935659
requireScope,
35660+
disallowScopes,
3566035661
wip,
3566135662
subjectPattern,
3566235663
subjectPatternError,
@@ -35715,6 +35716,7 @@ module.exports = async function run() {
3571535716
types,
3571635717
scopes,
3571735718
requireScope,
35719+
disallowScopes,
3571835720
subjectPattern,
3571935721
subjectPatternError,
3572035722
headerPattern,
@@ -35756,6 +35758,7 @@ module.exports = async function run() {
3575635758
types,
3575735759
scopes,
3575835760
requireScope,
35761+
disallowScopes,
3575935762
subjectPattern,
3576035763
subjectPatternError,
3576135764
headerPattern,
@@ -35838,6 +35841,11 @@ module.exports = function parseConfig() {
3583835841
requireScope = ConfigParser.parseBoolean(process.env.INPUT_REQUIRESCOPE);
3583935842
}
3584035843

35844+
let disallowScopes;
35845+
if (process.env.INPUT_DISALLOWSCOPES) {
35846+
disallowScopes = ConfigParser.parseEnum(process.env.INPUT_DISALLOWSCOPES);
35847+
}
35848+
3584135849
let subjectPattern;
3584235850
if (process.env.INPUT_SUBJECTPATTERN) {
3584335851
subjectPattern = ConfigParser.parseString(process.env.INPUT_SUBJECTPATTERN);
@@ -35895,6 +35903,7 @@ module.exports = function parseConfig() {
3589535903
types,
3589635904
scopes,
3589735905
requireScope,
35906+
disallowScopes,
3589835907
wip,
3589935908
subjectPattern,
3590035909
subjectPatternError,
@@ -35926,6 +35935,7 @@ module.exports = async function validatePrTitle(
3592635935
types,
3592735936
scopes,
3592835937
requireScope,
35938+
disallowScopes,
3592935939
subjectPattern,
3593035940
subjectPatternError,
3593135941
headerPattern,
@@ -35961,6 +35971,10 @@ module.exports = async function validatePrTitle(
3596135971
return scopes && !scopes.includes(s);
3596235972
}
3596335973

35974+
function isDisallowedScope(s) {
35975+
return disallowScopes && disallowScopes.includes(s);
35976+
}
35977+
3596435978
if (!result.type) {
3596535979
throw new Error(
3596635980
`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()}`
@@ -35991,6 +36005,7 @@ module.exports = async function validatePrTitle(
3599136005
const givenScopes = result.scope
3599236006
? result.scope.split(',').map((scope) => scope.trim())
3599336007
: undefined;
36008+
3599436009
const unknownScopes = givenScopes ? givenScopes.filter(isUnknownScope) : [];
3599536010
if (scopes && unknownScopes.length > 0) {
3599636011
throw new Error(
@@ -36004,6 +36019,17 @@ module.exports = async function validatePrTitle(
3600436019
);
3600536020
}
3600636021

36022+
const disallowedScopes = givenScopes
36023+
? givenScopes.filter(isDisallowedScope)
36024+
: [];
36025+
if (disallowScopes && disallowedScopes.length > 0) {
36026+
throw new Error(
36027+
`Disallowed ${
36028+
disallowedScopes.length === 1 ? 'scope was' : 'scopes were'
36029+
} found: ${disallowScopes.join(', ')}`
36030+
);
36031+
}
36032+
3600736033
function throwSubjectPatternError(message) {
3600836034
if (subjectPatternError) {
3600936035
message = formatMessage(subjectPatternError, {

0 commit comments

Comments
 (0)