From 1001d9ae1900adba5faf84d1d6aace98dab1b77f Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Thu, 16 Apr 2026 14:26:09 +0100 Subject: [PATCH 1/9] CCM-15317: Adding New PR Enforcement Action --- .../actions/check-pr-title-format/action.yml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/actions/check-pr-title-format/action.yml diff --git a/.github/actions/check-pr-title-format/action.yml b/.github/actions/check-pr-title-format/action.yml new file mode 100644 index 0000000..8596f19 --- /dev/null +++ b/.github/actions/check-pr-title-format/action.yml @@ -0,0 +1,33 @@ +name: Validate PR title +description: Validate pull request title against a regex +inputs: + title: + descriptions: Pull request title + required: true + required: false + pattern: + description: Regex pattern the PR title must match + required: true + error_message: + description: Custom error message + required: false + default: Pull request title does not match required format +runs: + using: composite + steps: + - name: Validate PR title + shell: bash + run: | + title="${{ inputs.title }}" + pattern="${{ inputs.pattern }}" + message="${{ inputs.error_message }}" + + echo "PR title: $title" + echo "Required pattern: $pattern" + + if [[ "$title" =~ $pattern ]]; then + echo "PR title is valid" + else if + echo "::error::$message" + exit 1 + fi From aa7d19f6f158036214d58a2c5f0d94bdaa068161 Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Thu, 16 Apr 2026 15:19:29 +0100 Subject: [PATCH 2/9] CCM-15317: Adding New PR Enforcement Action --- .github/actions/check-pr-title-format/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/check-pr-title-format/action.yml b/.github/actions/check-pr-title-format/action.yml index 8596f19..cc6f317 100644 --- a/.github/actions/check-pr-title-format/action.yml +++ b/.github/actions/check-pr-title-format/action.yml @@ -2,9 +2,8 @@ name: Validate PR title description: Validate pull request title against a regex inputs: title: - descriptions: Pull request title + description: Pull request title required: true - required: false pattern: description: Regex pattern the PR title must match required: true @@ -27,7 +26,7 @@ runs: if [[ "$title" =~ $pattern ]]; then echo "PR title is valid" - else if + else echo "::error::$message" exit 1 fi From eb719f61a1a63b3a9b457926be9e5ca0c9ab4f1c Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Thu, 16 Apr 2026 15:58:50 +0100 Subject: [PATCH 3/9] CCM-15317: Adding New PR Enforcement Action --- .../actions/check-pr-title-format/action.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-pr-title-format/action.yml b/.github/actions/check-pr-title-format/action.yml index cc6f317..32b2cd7 100644 --- a/.github/actions/check-pr-title-format/action.yml +++ b/.github/actions/check-pr-title-format/action.yml @@ -24,9 +24,24 @@ runs: echo "PR title: $title" echo "Required pattern: $pattern" - if [[ "$title" =~ $pattern ]]; then + if [ -z "$pattern" ]; then + echo "::error::Input 'pattern' must be a non-empty regular expression" + exit 1 + fi + if printf '%s\n' "$title" | grep -Eq -- "$pattern"; then echo "PR title is valid" else - echo "::error::$message" + status=$? + case "$status" in + 1) + echo "::error::$message" + ;; + 2) + echo "::error::Input 'pattern' is not a valid regular expression: $pattern" + ;; + *) + echo "::error::Unexpected error while validating PR title" + ;; + esac exit 1 fi From 88f90b584e5721125a01db86c99c2501b61343ff Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Thu, 16 Apr 2026 16:14:13 +0100 Subject: [PATCH 4/9] CCM-15317: Adding New PR Enforcement Action --- .github/actions/check-pr-title-format/action.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/actions/check-pr-title-format/action.yml b/.github/actions/check-pr-title-format/action.yml index 32b2cd7..5329e74 100644 --- a/.github/actions/check-pr-title-format/action.yml +++ b/.github/actions/check-pr-title-format/action.yml @@ -16,10 +16,14 @@ runs: steps: - name: Validate PR title shell: bash + env: + TITLE: ${{ inputs.title }} + PATTERN: ${{ inputs.pattern }} + MESSAGE: ${{ inputs.error_message }} run: | - title="${{ inputs.title }}" - pattern="${{ inputs.pattern }}" - message="${{ inputs.error_message }}" + title="$TITLE" + pattern="$PATTERN" + message="$MESSAGE" echo "PR title: $title" echo "Required pattern: $pattern" From d78128bb0cd43e06d0e12d9c485623be79b38e71 Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Wed, 22 Apr 2026 12:31:41 +0100 Subject: [PATCH 5/9] CCM-15317: Adding new action to shared-modules --- .github/actions/check-pr-title-format/action.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-pr-title-format/action.yml b/.github/actions/check-pr-title-format/action.yml index 5329e74..9159d83 100644 --- a/.github/actions/check-pr-title-format/action.yml +++ b/.github/actions/check-pr-title-format/action.yml @@ -25,6 +25,17 @@ runs: pattern="$PATTERN" message="$MESSAGE" + escape_workflow_command_value() { + local value="$1" + value="${value//'%'/'%25'}" + value="${value//$'\r'/'%0D'}" + value="${value//$'\n'/'%0A'}" + printf '%s' "$value" + } + + escaped_message="$(escape_workflow_command_value "$message")" + escaped_pattern="$(escape_workflow_command_value "$pattern")" + echo "PR title: $title" echo "Required pattern: $pattern" @@ -38,10 +49,10 @@ runs: status=$? case "$status" in 1) - echo "::error::$message" + echo "::error::$escaped_message" ;; 2) - echo "::error::Input 'pattern' is not a valid regular expression: $pattern" + echo "::error::Input 'pattern' is not a valid regular expression: $escaped_pattern" ;; *) echo "::error::Unexpected error while validating PR title" From 413e6c3273b1b06bd839a2be162f6b33f8f20501 Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Wed, 22 Apr 2026 12:40:01 +0100 Subject: [PATCH 6/9] CCM-15317: Adding new action to shared-modules --- .github/actions/check-pr-title-format/{action.yml => action.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/check-pr-title-format/{action.yml => action.yaml} (100%) diff --git a/.github/actions/check-pr-title-format/action.yml b/.github/actions/check-pr-title-format/action.yaml similarity index 100% rename from .github/actions/check-pr-title-format/action.yml rename to .github/actions/check-pr-title-format/action.yaml From 74ea8810c8d650bc3338cd84a8bb36e05589781c Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Wed, 22 Apr 2026 15:29:20 +0100 Subject: [PATCH 7/9] CCM-15317: Adding new action to shared-modules --- .github/actions/check-pr-title-format/action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/check-pr-title-format/action.yaml b/.github/actions/check-pr-title-format/action.yaml index 9159d83..ffd241f 100644 --- a/.github/actions/check-pr-title-format/action.yaml +++ b/.github/actions/check-pr-title-format/action.yaml @@ -6,7 +6,8 @@ inputs: required: true pattern: description: Regex pattern the PR title must match - required: true + required: false + default: '^CCM-[0-9]+: .+$' error_message: description: Custom error message required: false From 9a579ebe28c061e4afd2ebe43cdb9c44a079f36c Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Thu, 23 Apr 2026 09:23:08 +0100 Subject: [PATCH 8/9] CCM-15317: Adding new action to shared-modules --- .../actions/check-pr-title-format/action.yaml | 43 ++----------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/.github/actions/check-pr-title-format/action.yaml b/.github/actions/check-pr-title-format/action.yaml index ffd241f..9c82060 100644 --- a/.github/actions/check-pr-title-format/action.yaml +++ b/.github/actions/check-pr-title-format/action.yaml @@ -4,14 +4,6 @@ inputs: title: description: Pull request title required: true - pattern: - description: Regex pattern the PR title must match - required: false - default: '^CCM-[0-9]+: .+$' - error_message: - description: Custom error message - required: false - default: Pull request title does not match required format runs: using: composite steps: @@ -19,45 +11,16 @@ runs: shell: bash env: TITLE: ${{ inputs.title }} - PATTERN: ${{ inputs.pattern }} - MESSAGE: ${{ inputs.error_message }} run: | title="$TITLE" - pattern="$PATTERN" - message="$MESSAGE" - - escape_workflow_command_value() { - local value="$1" - value="${value//'%'/'%25'}" - value="${value//$'\r'/'%0D'}" - value="${value//$'\n'/'%0A'}" - printf '%s' "$value" - } - - escaped_message="$(escape_workflow_command_value "$message")" - escaped_pattern="$(escape_workflow_command_value "$pattern")" + pattern='^CCM-[0-9]+: .+$' + message='PR title must match: CCM-1234: Some Text' echo "PR title: $title" - echo "Required pattern: $pattern" - if [ -z "$pattern" ]; then - echo "::error::Input 'pattern' must be a non-empty regular expression" - exit 1 - fi if printf '%s\n' "$title" | grep -Eq -- "$pattern"; then echo "PR title is valid" else - status=$? - case "$status" in - 1) - echo "::error::$escaped_message" - ;; - 2) - echo "::error::Input 'pattern' is not a valid regular expression: $escaped_pattern" - ;; - *) - echo "::error::Unexpected error while validating PR title" - ;; - esac + echo "::error::$message" exit 1 fi From 1132f7deafb6f4fd0eb23c10fec09980c67a90f1 Mon Sep 17 00:00:00 2001 From: damientobin1 Date: Thu, 23 Apr 2026 09:57:29 +0100 Subject: [PATCH 9/9] CCM-15317: Adding new action to shared-modules --- .github/actions/check-pr-title-format/action.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/check-pr-title-format/action.yaml b/.github/actions/check-pr-title-format/action.yaml index 9c82060..f754a08 100644 --- a/.github/actions/check-pr-title-format/action.yaml +++ b/.github/actions/check-pr-title-format/action.yaml @@ -1,13 +1,13 @@ name: Validate PR title -description: Validate pull request title against a regex +description: "Validate pull request title against a regex" inputs: title: - description: Pull request title + description: "Pull request title" required: true runs: - using: composite + using: "composite" steps: - - name: Validate PR title + - name: "Validate PR title" shell: bash env: TITLE: ${{ inputs.title }}