From f8423b46337c20dc388158a94c3e24648182a4f0 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 25 Oct 2024 16:34:00 +0200 Subject: [PATCH 1/2] Add a workflow to validate PR titles --- .github/workflows/check-pr-title.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/check-pr-title.yml diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml new file mode 100644 index 0000000000..2a5dcc59b8 --- /dev/null +++ b/.github/workflows/check-pr-title.yml @@ -0,0 +1,24 @@ +name: "Check PR Title" +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited] + +jobs: + check-pr-title: + name: Check PR Title + runs-on: ubuntu-latest + steps: + - name: Enforce conventional commit style + uses: realm/ci-actions/title-checker@main + with: + regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|ops){1}(\([\w\-\.]+\))?(!)?: .*' + error-hint: 'Invalid PR title. Make sure it follows the conventional commit specification (i.e. "(): ") or add the no-title-validation label' + ignore-labels: 'no-title-validation' + - name: Enforce JIRA ticket in title + uses: realm/ci-actions/title-checker@main + # Skip the JIRA ticket check for PRs opened by bots + if: ${{ !contains(github.event.pull_request.user.login, '[bot]') }} + with: + regex: '[A-Z]{4,10}-[0-9]{1,5}$' + error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. VSCODE-1234 or add the no-title-validation label' + ignore-labels: 'no-title-validation' From 6764786adfd496f12bc245740e244fc1c32b29c3 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 25 Oct 2024 16:58:27 +0200 Subject: [PATCH 2/2] Change the example jira ticket --- .github/workflows/check-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 2a5dcc59b8..d5da06db53 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -20,5 +20,5 @@ jobs: if: ${{ !contains(github.event.pull_request.user.login, '[bot]') }} with: regex: '[A-Z]{4,10}-[0-9]{1,5}$' - error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. VSCODE-1234 or add the no-title-validation label' + error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. MONGOSH-1234 or add the no-title-validation label' ignore-labels: 'no-title-validation'