Skip to content

Commit 0eb081b

Browse files
chore: Release 4.2.0 [skip ci]
1 parent c05e358 commit 0eb081b

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
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.2.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.1.0...v4.2.0) (2022-02-08)
4+
5+
6+
### Features
7+
8+
* Add opt-in validation that PR titles match a single commit ([#160](https://github.com/amannn/action-semantic-pull-request/issues/160)) ([c05e358](https://github.com/amannn/action-semantic-pull-request/commit/c05e3587cb7878ec080300180d31d61ba1cf01ea))
9+
310
## [4.1.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.0.1...v4.1.0) (2022-02-04)
411

512

dist/index.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35661,6 +35661,7 @@ module.exports = async function run() {
3566135661
subjectPattern,
3566235662
subjectPatternError,
3566335663
validateSingleCommit,
35664+
validateSingleCommitMatchesPrTitle,
3566435665
githubBaseUrl
3566535666
} = parseConfig();
3566635667

@@ -35746,12 +35747,14 @@ module.exports = async function run() {
3574635747
);
3574735748
}
3574835749

35749-
const commitTitle =
35750-
nonMergeCommits[0].commit.message.split('\n')[0];
35751-
if (commitTitle !== pullRequest.title) {
35752-
throw new Error(
35753-
`The pull request has only one (non-merge) commit and in this case Github will use it as the default commit message when merging. The pull request title doesn't match the commit though ("${pullRequest.title}" vs. "${commitTitle}"). Please update the pull request title accordingly to avoid surprises.`
35754-
);
35750+
if (validateSingleCommitMatchesPrTitle) {
35751+
const commitTitle =
35752+
nonMergeCommits[0].commit.message.split('\n')[0];
35753+
if (commitTitle !== pullRequest.title) {
35754+
throw new Error(
35755+
`The pull request has only one (non-merge) commit and in this case Github will use it as the default commit message when merging. The pull request title doesn't match the commit though ("${pullRequest.title}" vs. "${commitTitle}"). Please update the pull request title accordingly to avoid surprises.`
35756+
);
35757+
}
3575535758
}
3575635759
}
3575735760
}
@@ -35839,6 +35842,13 @@ module.exports = function parseConfig() {
3583935842
);
3584035843
}
3584135844

35845+
let validateSingleCommitMatchesPrTitle;
35846+
if (process.env.INPUT_VALIDATESINGLECOMMITMATCHESPRTITLE) {
35847+
validateSingleCommitMatchesPrTitle = ConfigParser.parseBoolean(
35848+
process.env.INPUT_VALIDATESINGLECOMMITMATCHESPRTITLE
35849+
);
35850+
}
35851+
3584235852
let githubBaseUrl;
3584335853
if (process.env.INPUT_GITHUBBASEURL) {
3584435854
githubBaseUrl = ConfigParser.parseString(process.env.INPUT_GITHUBBASEURL);
@@ -35852,6 +35862,7 @@ module.exports = function parseConfig() {
3585235862
subjectPattern,
3585335863
subjectPatternError,
3585435864
validateSingleCommit,
35865+
validateSingleCommitMatchesPrTitle,
3585535866
githubBaseUrl
3585635867
};
3585735868
};

0 commit comments

Comments
 (0)