From 63fad9ff326a7f281592969637b08f6349b0d72e Mon Sep 17 00:00:00 2001 From: RedStar Date: Mon, 16 Nov 2026 20:10:54 +0100 Subject: [PATCH] ci: post sticky comment on invalid PR title Explain a failed title check in the pull request, like redstar071.dev. The comment goes away once the title is valid. --- .github/workflows/semantic-pull-requests.yml | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/semantic-pull-requests.yml b/.github/workflows/semantic-pull-requests.yml index 6658a17d..c10ac579 100644 --- a/.github/workflows/semantic-pull-requests.yml +++ b/.github/workflows/semantic-pull-requests.yml @@ -21,10 +21,11 @@ jobs: if: github.repository == 'wolfstar-project/plugins' permissions: contents: read - pull-requests: read + pull-requests: write # read the PR and post or delete the sticky comment statuses: write steps: - name: Validate PR title + id: lint_pr_title uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 with: types: | @@ -64,3 +65,27 @@ jobs: does not start with an uppercase character. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 + # When the previous step fails, the workflow would stop. This condition + # keeps it going so the error message can be posted. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! 👋🏼 + + Pull request titles need to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/), and it looks like this one needs a small adjustment. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete the previous comment once the title has been fixed + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 + with: + header: pr-title-lint-error + delete: true