From b10dd52ac5faedc64be15aaa8dc0b4656020e1dd Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Thu, 24 Oct 2024 17:01:47 +0200 Subject: [PATCH 1/4] Add github action for PR title validation --- .github/workflows/check-pr-title.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 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 000000000..6cb17f606 --- /dev/null +++ b/.github/workflows/check-pr-title.yml @@ -0,0 +1,22 @@ +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-jira-ticket' + - name: Enforce JIRA ticket in title + uses: realm/ci-actions/title-checker@main + with: + regex: 'VSCODE-[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 399564a90eb1161107015ac55a180b711cbc974b Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Thu, 24 Oct 2024 17:25:30 +0200 Subject: [PATCH 2/4] Use the correct ignore label --- .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 6cb17f606..6e88503d3 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -13,7 +13,7 @@ jobs: 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-jira-ticket' + ignore-labels: 'no-title-validation' - name: Enforce JIRA ticket in title uses: realm/ci-actions/title-checker@main with: From 461e62047c036310b032dafdd4a2e6a3562eeec7 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 25 Oct 2024 12:11:31 +0200 Subject: [PATCH 3/4] Relax the JIRA regex --- .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 6e88503d3..06c9c6e70 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -17,6 +17,6 @@ jobs: - name: Enforce JIRA ticket in title uses: realm/ci-actions/title-checker@main with: - regex: 'VSCODE-[0-9]{1,5}$' + 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 b1df706f9d267fa28a3b86ad278d8c1d4a40b8b2 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 25 Oct 2024 16:26:59 +0200 Subject: [PATCH 4/4] Don't enforce Jira ticket check for bot PRs --- .github/workflows/check-pr-title.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 06c9c6e70..2a5dcc59b 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -16,6 +16,8 @@ jobs: 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'