Skip to content

Commit

Permalink
chore: Release 4.2.0 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
semantic-release-bot committed Feb 8, 2022
1 parent c05e358 commit 0eb081b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 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.2.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.1.0...v4.2.0) (2022-02-08)


### Features

* 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))

## [4.1.0](https://github.com/amannn/action-semantic-pull-request/compare/v4.0.1...v4.1.0) (2022-02-04)


Expand Down
23 changes: 17 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35661,6 +35661,7 @@ module.exports = async function run() {
subjectPattern,
subjectPatternError,
validateSingleCommit,
validateSingleCommitMatchesPrTitle,
githubBaseUrl
} = parseConfig();

Expand Down Expand Up @@ -35746,12 +35747,14 @@ module.exports = async function run() {
);
}

const commitTitle =
nonMergeCommits[0].commit.message.split('\n')[0];
if (commitTitle !== pullRequest.title) {
throw new Error(
`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.`
);
if (validateSingleCommitMatchesPrTitle) {
const commitTitle =
nonMergeCommits[0].commit.message.split('\n')[0];
if (commitTitle !== pullRequest.title) {
throw new Error(
`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.`
);
}
}
}
}
Expand Down Expand Up @@ -35839,6 +35842,13 @@ module.exports = function parseConfig() {
);
}

let validateSingleCommitMatchesPrTitle;
if (process.env.INPUT_VALIDATESINGLECOMMITMATCHESPRTITLE) {
validateSingleCommitMatchesPrTitle = ConfigParser.parseBoolean(
process.env.INPUT_VALIDATESINGLECOMMITMATCHESPRTITLE
);
}

let githubBaseUrl;
if (process.env.INPUT_GITHUBBASEURL) {
githubBaseUrl = ConfigParser.parseString(process.env.INPUT_GITHUBBASEURL);
Expand All @@ -35852,6 +35862,7 @@ module.exports = function parseConfig() {
subjectPattern,
subjectPatternError,
validateSingleCommit,
validateSingleCommitMatchesPrTitle,
githubBaseUrl
};
};
Expand Down

0 comments on commit 0eb081b

Please sign in to comment.