From c26c123aae4599592af15081a260b77b4cf2825c Mon Sep 17 00:00:00 2001 From: zachaller Date: Wed, 12 Oct 2022 17:00:42 -0500 Subject: [PATCH 1/5] feat(ci): Add github action for PR Conventional Commits Signed-off-by: zachaller --- .github/workflows/pr-title-check.yml | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/pr-title-check.yml diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml new file mode 100644 index 0000000000..134850e0ec --- /dev/null +++ b/.github/workflows/pr-title-check.yml @@ -0,0 +1,55 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Configure which types are allowed (newline delimited). + # Default: https://github.com/commitizen/conventional-commit-types + types: | + feat + fix + docs + style + refactor + perf + test + build + ci + chore + revert + + # Configure which scopes are allowed (newline delimited). + scopes: | + controller + dashboard + trafficrouting + analysis + metricprovider + experiments + deps + + # Configure that a scope must always be provided. + requireScope: true + # Configure additional validation for the subject based on a regex. + # This example ensures the subject doesn't start with an uppercase character. + subjectPattern: ^(?![A-Z]).+$ + # If `subjectPattern` is configured, you can use this property to override + # the default error message that is shown when the pattern doesn't match. + # The variables `subject` and `title` can be used within the message. + subjectPatternError: | + The subject "{subject}" found in the pull request title "{title}" + didn't match the configured pattern. Please ensure that the subject + doesn't start with an uppercase character. From 54c4eff5471b11a9f8c9e45e7e5cd45cb07c2ad8 Mon Sep 17 00:00:00 2001 From: zachaller Date: Wed, 12 Oct 2022 17:37:23 -0500 Subject: [PATCH 2/5] add example scope Signed-off-by: zachaller --- .github/workflows/pr-title-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index 134850e0ec..27e6fa75b1 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -40,6 +40,7 @@ jobs: metricprovider experiments deps + example # Configure that a scope must always be provided. requireScope: true From e2a372ec176ddf727c81c0568ef6b07a0a0b0301 Mon Sep 17 00:00:00 2001 From: zachaller Date: Wed, 12 Oct 2022 21:14:11 -0500 Subject: [PATCH 3/5] add cli as scope Signed-off-by: zachaller --- .github/workflows/pr-title-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index 27e6fa75b1..801888a833 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -41,6 +41,7 @@ jobs: experiments deps example + cli # Configure that a scope must always be provided. requireScope: true From 54e2da9b8ea0b133c4156cc5a56b3e8b1ddf37d5 Mon Sep 17 00:00:00 2001 From: zachaller Date: Thu, 13 Oct 2022 09:52:39 -0500 Subject: [PATCH 4/5] Remove configuration Signed-off-by: zachaller --- .github/workflows/pr-title-check.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index 801888a833..112cea06a0 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -45,13 +45,3 @@ jobs: # Configure that a scope must always be provided. requireScope: true - # Configure additional validation for the subject based on a regex. - # This example ensures the subject doesn't start with an uppercase character. - subjectPattern: ^(?![A-Z]).+$ - # If `subjectPattern` is configured, you can use this property to override - # the default error message that is shown when the pattern doesn't match. - # The variables `subject` and `title` can be used within the message. - subjectPatternError: | - The subject "{subject}" found in the pull request title "{title}" - didn't match the configured pattern. Please ensure that the subject - doesn't start with an uppercase character. From b37c41fc7ac71ff963c07724a0066bb797853b8f Mon Sep 17 00:00:00 2001 From: zachaller Date: Thu, 13 Oct 2022 20:40:23 -0500 Subject: [PATCH 5/5] scopes not required Signed-off-by: zachaller --- .github/workflows/pr-title-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index 112cea06a0..5f11c118ae 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -44,4 +44,4 @@ jobs: cli # Configure that a scope must always be provided. - requireScope: true + requireScope: false