From 23b0e71511aaeb4db6656d73a7c156d7550a8a4d Mon Sep 17 00:00:00 2001 From: mahdichtioui Date: Thu, 28 Nov 2024 12:52:14 +0100 Subject: [PATCH] ci: Implement conventional commit validation --- build/steps-build-android.yml | 2 ++ build/steps-build-ios.yml | 2 ++ build/steps-build-windows.yml | 1 + build/templates/validate-commits.yaml | 10 ++++++++++ 4 files changed, 15 insertions(+) create mode 100644 build/templates/validate-commits.yaml diff --git a/build/steps-build-android.yml b/build/steps-build-android.yml index cb1e4d8..19e40b4 100644 --- a/build/steps-build-android.yml +++ b/build/steps-build-android.yml @@ -16,6 +16,8 @@ parameters: type: string steps: +- template: templates/validate-commits.yaml + #-if false - download: current condition: eq('GeneratedApp', '${{ parameters.projectName }}') diff --git a/build/steps-build-ios.yml b/build/steps-build-ios.yml index 2c11ba7..b71fe77 100644 --- a/build/steps-build-ios.yml +++ b/build/steps-build-ios.yml @@ -22,6 +22,8 @@ parameters: type: string steps: +- template: templates/validate-commits.yaml + #-if false - download: current condition: eq('GeneratedApp', '${{ parameters.projectName }}') diff --git a/build/steps-build-windows.yml b/build/steps-build-windows.yml index 7a894cf..44322de 100644 --- a/build/steps-build-windows.yml +++ b/build/steps-build-windows.yml @@ -7,6 +7,7 @@ default: '$(ProjectName)' steps: +- template: templates/validate-commits.yaml - template: templates/gitversion.yml - template: templates/build-number.yml - template: templates/flutter-install.yml diff --git a/build/templates/validate-commits.yaml b/build/templates/validate-commits.yaml new file mode 100644 index 0000000..ac202ee --- /dev/null +++ b/build/templates/validate-commits.yaml @@ -0,0 +1,10 @@ +# This template follow the Conventional Commits specification (https://www.conventionalcommits.org/en/v1.0.0/). +steps: + - task: CommitMessageValidator@0 + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) + inputs: + regExPattern: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\.\-\p{Extended_Pictographic}]+\))?(!)?: ([\w \p{Extended_Pictographic}])+([\s\S]*)' + regExFlags: "um" + allCommitsMustMatch: true + prMode: true + displayName: 'Validate Commit Messages' \ No newline at end of file