We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa7d19f commit eb719f6Copy full SHA for eb719f6
1 file changed
.github/actions/check-pr-title-format/action.yml
@@ -24,9 +24,24 @@ runs:
24
echo "PR title: $title"
25
echo "Required pattern: $pattern"
26
27
- if [[ "$title" =~ $pattern ]]; then
+ if [ -z "$pattern" ]; then
28
+ echo "::error::Input 'pattern' must be a non-empty regular expression"
29
+ exit 1
30
+ fi
31
+ if printf '%s\n' "$title" | grep -Eq -- "$pattern"; then
32
echo "PR title is valid"
33
else
- echo "::error::$message"
34
+ status=$?
35
+ case "$status" in
36
+ 1)
37
+ echo "::error::$message"
38
+ ;;
39
+ 2)
40
+ echo "::error::Input 'pattern' is not a valid regular expression: $pattern"
41
42
+ *)
43
+ echo "::error::Unexpected error while validating PR title"
44
45
+ esac
46
exit 1
47
fi
0 commit comments