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
Copy file name to clipboardExpand all lines: action.yml
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,9 @@ inputs:
17
17
requireScope:
18
18
description: "Configure that a scope must always be provided."
19
19
required: false
20
+
subjectPattern:
21
+
description: "Configure additional validation for the subject based on a regex. E.g. '^(?![A-Z]).+$' ensures the subject doesn't start with an uppercase character."
22
+
required: false
20
23
wip:
21
24
description: "For work-in-progress PRs you can typically use draft pull requests from Github. However, private repositories on the free plan don't have this option and therefore this action allows you to opt-in to using the special '[WIP]' prefix to indicate this state. This will avoid the validation of the PR title and the pull request checks remain pending. Note that a second check will be reported if this is enabled."
`The subject "${result.subject}" found in pull request title "${prTitle}" doesn't match the configured pattern "${subjectPattern}".`
72
+
);
73
+
}
74
+
75
+
constmatchedPart=match[0];
76
+
if(matchedPart.length!==result.subject.length){
77
+
thrownewError(
78
+
`The subject "${result.subject}" found in pull request title "${prTitle}" isn't an exact match for the configured pattern "${subjectPattern}". Please provide a subject that matches the whole pattern exactly.`
it('does not validate the description by default',async()=>{
108
+
awaitvalidatePrTitle('fix: sK!"§4123');
109
+
});
110
+
111
+
it('throws for invalid subjects',async()=>{
112
+
awaitexpect(
113
+
validatePrTitle('fix: Foobar',{
114
+
subjectPattern: '^(?![A-Z]).+$'
115
+
})
116
+
).rejects.toThrow(
117
+
'The subject "Foobar" found in pull request title "fix: Foobar" doesn\'t match the configured pattern "^(?![A-Z]).+$".'
118
+
);
119
+
});
120
+
121
+
it('throws for only partial matches',async()=>{
122
+
awaitexpect(
123
+
validatePrTitle('fix: Foobar',{
124
+
subjectPattern: 'Foo'
125
+
})
126
+
).rejects.toThrow(
127
+
'The subject "Foobar" found in pull request title "fix: Foobar" isn\'t an exact match for the configured pattern "Foo". Please provide a subject that matches the whole pattern exactly.'
0 commit comments