From 23ec676c945f3417d78c572feebd88488938e2f4 Mon Sep 17 00:00:00 2001 From: Krishna Kumar S <71367204+Krishks369@users.noreply.github.com> Date: Fri, 29 Jul 2022 21:20:43 +0530 Subject: [PATCH 1/7] add error comment --- .github/workflows/lint-pr-title.yml | 35 ++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 87e2fa5e..aeff6d72 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -1,23 +1,46 @@ # This action is centrally managed in https://github.com/asyncapi/.github/ # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo + + name: Lint PR title on: pull_request_target: types: [opened, reopened, synchronize, edited, ready_for_review] - + jobs: lint-pr-title: - name: Lint PR title - runs-on: ubuntu-latest - steps: + name: Lint PR title + runs-on: ubuntu-latest + steps: # Since this workflow is REQUIRED for a PR to be mergable, we have to have this 'if' statement in step level instead of job level. - if: ${{ !contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]", "allcontributors"]'), github.actor) }} - uses: amannn/action-semantic-pull-request@v3.2.5 + uses: Krishks369/action-semantic-pull-request@3fb9141f164e97c267a18fe560474547fd7f1fff + id: lint_pr_title env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: subjectPattern: ^(?![A-Z]).+$ subjectPatternError: | The subject "{subject}" found in the pull request title "{title}" should start with a lowercase character. + + # Comments the error message from the above lint_pr_title action and deletes the comment when the linting is correct + - if: always() + name: Comment on PR + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: comment + message: | + ``` + ${{ steps.lint_pr_title.outputs.error_message}} + ``` + # deletes the error comment if the title is correct + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + name: delete the comment + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: comment + delete: true + + From 97d08c2a69b59d4fe5a3c47c6e3ec5ae2810f058 Mon Sep 17 00:00:00 2001 From: Krishna Kumar S <71367204+Krishks369@users.noreply.github.com> Date: Tue, 6 Sep 2022 20:29:48 +0530 Subject: [PATCH 2/7] Update lint-pr-title.yml --- .github/workflows/lint-pr-title.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index aeff6d72..77ea4192 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -32,7 +32,8 @@ jobs: with: header: comment message: | - ``` + ```Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request.
+ We require all PRs to follow Conventional Commits specification. More details 👇🏼 ${{ steps.lint_pr_title.outputs.error_message}} ``` # deletes the error comment if the title is correct From ef5b91953d17cd72c7a6922e94c41474e472ef78 Mon Sep 17 00:00:00 2001 From: Krishna Kumar S <71367204+Krishks369@users.noreply.github.com> Date: Tue, 6 Sep 2022 20:32:31 +0530 Subject: [PATCH 3/7] Update lint-pr-title.yml --- .github/workflows/lint-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 77ea4192..7d43bde7 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -32,7 +32,7 @@ jobs: with: header: comment message: | - ```Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request.
+ ```Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request. We require all PRs to follow Conventional Commits specification. More details 👇🏼 ${{ steps.lint_pr_title.outputs.error_message}} ``` From 24873911a03c432a0f42ba7aba1926d74ad47c5a Mon Sep 17 00:00:00 2001 From: Krishna Kumar S <71367204+Krishks369@users.noreply.github.com> Date: Tue, 6 Sep 2022 20:34:22 +0530 Subject: [PATCH 4/7] Update lint-pr-title.yml --- .github/workflows/lint-pr-title.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 7d43bde7..099ccdfb 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -32,8 +32,8 @@ jobs: with: header: comment message: | - ```Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request. - We require all PRs to follow Conventional Commits specification. More details 👇🏼 + ``` + Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request.
We require all PRs to follow Conventional Commits specification. More details 👇🏼 ${{ steps.lint_pr_title.outputs.error_message}} ``` # deletes the error comment if the title is correct From 4d6663c835dc5cf989bb360538552e3900d1f87e Mon Sep 17 00:00:00 2001 From: Krishna Kumar S <71367204+Krishks369@users.noreply.github.com> Date: Tue, 6 Sep 2022 20:35:47 +0530 Subject: [PATCH 5/7] Update lint-pr-title.yml --- .github/workflows/lint-pr-title.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 099ccdfb..9325f47c 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -33,7 +33,8 @@ jobs: header: comment message: | ``` - Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request.
We require all PRs to follow Conventional Commits specification. More details 👇🏼 + Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request. + We require all PRs to follow Conventional Commits specification. More details 👇🏼 ${{ steps.lint_pr_title.outputs.error_message}} ``` # deletes the error comment if the title is correct From 170a0aae552ad88430b67991d7a26b3703f22bda Mon Sep 17 00:00:00 2001 From: Krishna Kumar S <71367204+Krishks369@users.noreply.github.com> Date: Tue, 6 Sep 2022 20:37:34 +0530 Subject: [PATCH 6/7] Update lint-pr-title.yml --- .github/workflows/lint-pr-title.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 9325f47c..ba204794 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -35,6 +35,8 @@ jobs: ``` Hey there 👋🏼 thanks for opening the PR but we need you to adjust the title of the pull request. We require all PRs to follow Conventional Commits specification. More details 👇🏼 + + ${{ steps.lint_pr_title.outputs.error_message}} ``` # deletes the error comment if the title is correct From 174927a5807c2a7a9bc793eae03f500abe0a20ca Mon Sep 17 00:00:00 2001 From: Krishna Kumar S <71367204+Krishks369@users.noreply.github.com> Date: Fri, 23 Sep 2022 22:26:18 +0530 Subject: [PATCH 7/7] Update lint-pr-title.yml --- .github/workflows/lint-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index ba204794..90c9c339 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -25,7 +25,7 @@ jobs: subjectPatternError: | The subject "{subject}" found in the pull request title "{title}" should start with a lowercase character. - # Comments the error message from the above lint_pr_title action and deletes the comment when the linting is correct + # Comments the error message from the above lint_pr_title action - if: always() name: Comment on PR uses: marocchino/sticky-pull-request-comment@v2