diff --git a/.github/workflows/pr-template.yml b/.github/workflows/pr-template.yml index 8f891d97a6..349ac60863 100644 --- a/.github/workflows/pr-template.yml +++ b/.github/workflows/pr-template.yml @@ -112,13 +112,14 @@ jobs: }); } - - name: Remove incomplete label + - name: Remove incomplete label and comment if: steps.validate.outcome == 'success' uses: actions/github-script@v8 with: github-token: ${{ secrets.BOT }} script: | const label = "reason: incomplete pr"; + const marker = ""; try { await github.rest.issues.removeLabel({ @@ -133,6 +134,28 @@ jobs: } } + const comments = await github.paginate( + github.rest.issues.listComments, + { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + } + ); + + for (const comment of comments) { + if ( + comment.user?.login === "is-a-dev-bot" && + comment.body?.includes(marker) + ) { + await github.rest.issues.deleteComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id + }); + } + } + - name: Fail if PR template is incomplete if: steps.validate.outcome == 'failure' run: |