From 4b58394cb68f5d71de652ea797bddc0d477c503a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 22 Sep 2025 13:32:35 +0000 Subject: [PATCH] feat: Add WIP prefix to PRs with bot comment Co-authored-by: matiss --- .github/workflows/pr-wip-prefix.yml | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/pr-wip-prefix.yml diff --git a/.github/workflows/pr-wip-prefix.yml b/.github/workflows/pr-wip-prefix.yml new file mode 100644 index 0000000000..982e9707a6 --- /dev/null +++ b/.github/workflows/pr-wip-prefix.yml @@ -0,0 +1,43 @@ +name: Add WIP prefix to PRs + +on: + pull_request: + types: [opened] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + add-wip-and-comment: + runs-on: ubuntu-latest + steps: + - name: Add [WIP] prefix to PR title + id: wip + uses: actions/github-script@v7 + with: + script: | + const title = context.payload.pull_request.title || ''; + const number = context.payload.pull_request.number; + const { owner, repo } = context.repo; + + const hasWip = /^\s*(\[\s*WIP\s*\]|WIP\b)/i.test(title); + let added = false; + if (!hasWip) { + const newTitle = `[WIP] ${title}`; + await github.rest.pulls.update({ owner, repo, pull_number: number, title: newTitle }); + added = true; + } + + core.setOutput('wip_added', String(added)); + + - name: Comment why WIP prefix was added + if: steps.wip.outputs.wip_added == 'true' + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + :wave: Hi! I have added a WIP prefix to the PR. Please remove it once the PR has all CI checks passed as green and once you are happy for a maintainer to review this PR. Thanks! + +