Repository navigation
Conversation
If PR is marked as non-draft (ready for review) and it contains WIP commits, a comment yelling to the author will be posed.
By adding 'synchronize' this workflow will also fire when more commits are added to a PR (so that if PR is not marked as DRAFT and the new commits are WIP, the author is warned that she should only test things in DRAFT PRs).
|
/pi please review this PR |
nodefect
left a comment
There was a problem hiding this comment.
The workflow has a few gaps that can miss WIP commits or post misleading/repeated warnings. Please address the event coverage and notification behavior before merging.
| # Use the base repository's token so comments also work for fork PRs. | ||
| # Never check out or execute PR code in this workflow. | ||
| pull_request_target: | ||
| types: [opened, synchronize, ready_for_review, converted_to_draft] |
There was a problem hiding this comment.
[P2] Recheck reopened PRs and base-branch changes
A ready PR can be closed, have WIP commits pushed while closed, and then be reopened; reopened is not subscribed, so it is never checked until another head update. Similarly, changing the base branch can introduce WIP commits into the PR without triggering these events. Subscribe to reopened and the relevant edited events and re-evaluate the PR.
|
|
||
| jobs: | ||
| comment-on-wip-commits: | ||
| if: github.event.pull_request.draft == false |
There was a problem hiding this comment.
[P2] Check the current draft state before posting
This uses the event snapshot, not the PR's current state. If a non-draft PR is pushed and then promptly converted to draft while the synchronize run is queued, that run still posts an admonishment on the now-draft PR. Fetch the current PR state before commenting (and consider cancelling superseded runs), so converting to draft actually prevents the warning.
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const pr = context.payload.pull_request; |
There was a problem hiding this comment.
[P3] Account for the 250-commit API limit
pulls.listCommits returns at most 250 commits for a PR, even when paginated. For larger PRs a WIP commit beyond that limit is silently missed. Use a complete commit listing/comparison for large PRs, or provide a fallback when the limit is reached.
| pull_number: pr.number, | ||
| per_page: 100 | ||
| }); | ||
|
|
There was a problem hiding this comment.
[P2] Detect lowercase WIP prefixes too
A commit such as wip: implement feature is a WIP commit but will not trigger this check. The repository's empty-wip rule also treats the prefix case-insensitively, so this creates an inconsistent gap for otherwise valid commit messages. Normalize the header's case before testing the prefix.
| if (!commits.some(commit => commit.commit.message.startsWith('WIP'))) { | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
[P2] Avoid posting the same warning on every push
Every synchronize event creates a new comment as long as any existing WIP commit remains, even when the push only adds an unrelated fix. A ready PR receiving several pushes will therefore accumulate identical comments and repeatedly notify its author. Reuse/update an existing bot warning or otherwise deduplicate while the same violation persists.
|
Review submitted with five findings covering missed WIP commits, event handling, and repeated or stale warnings. View action run | Model: ppq/auto | Time: 1m 46s | Tokens: 77.8K | Pi SDK v1.5.2 | Action v2.30.2-develop (develop @ d5e244b) |
If PR is marked as non-draft (ready for review) and it contains WIP commits, a comment yelling to the author will be posed.