From 188808cfe4807a48742f8f09445dbd72f8e76cc0 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:09:53 +0000 Subject: [PATCH] ci: use action to add pull request comment --- .github/workflows/pr-conventional-title.yml | 36 ++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr-conventional-title.yml b/.github/workflows/pr-conventional-title.yml index 4ed1cc65..2bdc7c5c 100644 --- a/.github/workflows/pr-conventional-title.yml +++ b/.github/workflows/pr-conventional-title.yml @@ -8,12 +8,13 @@ on: - edited - synchronize -permissions: - pull-requests: read +permissions: {} jobs: validate-pr-title: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f # v5.4.0 id: pr-title @@ -25,19 +26,24 @@ jobs: doesn't start with an uppercase character. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - if: always() && steps.pr-title.outputs.error_message != null - run: gh pr comment "$PR_NUMBER" --body "$BODY" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_REPO: ${{ github.repository }} - PR_NUMBER: ${{ github.event.pull_request.number }} - BODY: | - Hey there and thank you for opening this pull request! 👋🏼 + - uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 + if: always() && steps.pr-title.outputs.error_message != null + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! 👋🏼 - We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + We require pull request titles to follow the [Conventional Commits specification] + (https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed + title needs to be adjusted. - Details: + Details: - ``` - ${{ steps.pr-title.outputs.error_message }} - ``` + ``` + ${{ steps.pr-title.outputs.error_message }} + ``` + - if: steps.pr-title.outputs.error_message == null + uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 + with: + header: pr-title-lint-error + delete: true