You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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))
Copy file name to clipboardExpand all lines: dist/index.js
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -35661,6 +35661,7 @@ module.exports = async function run() {
35661
35661
subjectPattern,
35662
35662
subjectPatternError,
35663
35663
validateSingleCommit,
35664
+
validateSingleCommitMatchesPrTitle,
35664
35665
githubBaseUrl
35665
35666
} = parseConfig();
35666
35667
@@ -35746,12 +35747,14 @@ module.exports = async function run() {
35746
35747
);
35747
35748
}
35748
35749
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
+
}
35755
35758
}
35756
35759
}
35757
35760
}
@@ -35839,6 +35842,13 @@ module.exports = function parseConfig() {
35839
35842
);
35840
35843
}
35841
35844
35845
+
let validateSingleCommitMatchesPrTitle;
35846
+
if (process.env.INPUT_VALIDATESINGLECOMMITMATCHESPRTITLE) {
0 commit comments