From f6b453af9c90f25c947bd7df194f55120a563ca8 Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Sun, 11 Aug 2024 16:51:02 +0530 Subject: [PATCH 1/3] chore: add naming convention check for PRs --- .github/workflows/convention.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/convention.yml diff --git a/.github/workflows/convention.yml b/.github/workflows/convention.yml new file mode 100644 index 0000000000..4448e5cd8e --- /dev/null +++ b/.github/workflows/convention.yml @@ -0,0 +1,19 @@ +name: PR Naming Convention Check + +on: + pull_request: + types: [opened, edited] + +jobs: + check-name: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, '🙋 Bounty claim') + steps: + - name: Check PR Title + id: check_title + run: | + PR_TITLE="${{ github.event.pull_request.title }}" + if [[ ! "$PR_TITLE" =~ ^\[ISSUE_[0-9]+\]\ .+ ]]; then + echo "PR title does not follow the naming convention [ISSUE_NUMBER] " + exit 1 + fi From c0a008b5fbf24be957b25bdefdb02d07d3481ac5 Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Sun, 11 Aug 2024 16:53:26 +0530 Subject: [PATCH 2/3] chore: update hooks --- .github/workflows/convention.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/convention.yml b/.github/workflows/convention.yml index 4448e5cd8e..c4aeb7c1b1 100644 --- a/.github/workflows/convention.yml +++ b/.github/workflows/convention.yml @@ -2,7 +2,7 @@ name: PR Naming Convention Check on: pull_request: - types: [opened, edited] + types: [opened, edited, reopened, synchronize] jobs: check-name: From 4456074ab98eca2a434c7266379b877fccb66f20 Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Sun, 11 Aug 2024 17:07:21 +0530 Subject: [PATCH 3/3] chore: update ci --- .github/workflows/convention.yml | 37 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/convention.yml b/.github/workflows/convention.yml index c4aeb7c1b1..0694b9eaff 100644 --- a/.github/workflows/convention.yml +++ b/.github/workflows/convention.yml @@ -1,19 +1,30 @@ -name: PR Naming Convention Check +name: PR Title Validation on: - pull_request: - types: [opened, edited, reopened, synchronize] + # pull_request_target is ok until we do not checkout and build external code + # TODO: maybe it is not required after all https://github.com/amannn/action-semantic-pull-request/issues/219 + pull_request_target: + types: [opened, reopened, synchronize, edited] + +permissions: + pull-requests: read jobs: - check-name: + title-check: + name: Check PR Title runs-on: ubuntu-latest - if: contains(github.event.pull_request.labels.*.name, '🙋 Bounty claim') + steps: - - name: Check PR Title - id: check_title - run: | - PR_TITLE="${{ github.event.pull_request.title }}" - if [[ ! "$PR_TITLE" =~ ^\[ISSUE_[0-9]+\]\ .+ ]]; then - echo "PR title does not follow the naming convention [ISSUE_NUMBER] " - exit 1 - fi + - name: PR Title + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Bounty PR Title + if: contains(github.event.pull_request.labels.*.name, '🙋 Bounty claim') + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + requireScope: true + scopes: \d+