tools: unlabel author ready on base branch conflicts

Add a daily workflow that removes the `[author ready]` label from open
pull requests conflicting with their base branch and comments with
rebase guidance.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65872
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
This commit is contained in:
Filip Skokan authored and Antoine du Hamel committed 2026-09-22 16:55:43 +02:00
1 parent 6076111e1a
commit ab3c2a81f4
2 files changed
+49

No files matched your search

@@ -0,0 +1,48 @@
name: Unlabel not-ready pull requests
on:
schedule:
- cron: 15 3 * * *
permissions:
contents: read
jobs:
remove-label:
name: Remove author ready
if: github.repository == 'nodejs/node'
runs-on: ubuntu-slim
permissions:
pull-requests: write
steps:
- name: Remove the label and comment
env:
GH_TOKEN: ${{ github.token }}
MESSAGE: >-
This pull request has conflicts with its base branch, removing the
`author ready` label.
Please
[rebase](https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#step-5-rebase)
your branch onto the latest base branch, resolve the conflicts
locally, and force-push.
Afterwards the pull request needs a fresh collaborator approval,
and a collaborator will add the label back once it is
[author ready](https://github.com/nodejs/node/blob/HEAD/doc/contributing/collaborator-guide.md#author-ready-pull-requests)
again.
run: |
# Requesting the mergeable field makes GitHub compute the merge state,
# pull requests still reported as UNKNOWN are picked up by a later run.
gh pr list \
--repo "$GITHUB_REPOSITORY" \
--label 'author ready' \
--state open \
--limit 100 \
--json number,mergeable \
--jq '.[] | select(.mergeable == "CONFLICTING") | .number' |
while read -r number; do
gh pr edit "$number" --repo "$GITHUB_REPOSITORY" --remove-label 'author ready'
printf '%s\n' "$MESSAGE" |
gh pr comment "$number" --repo "$GITHUB_REPOSITORY" --body-file -
done
+1
View File
@@ -87,6 +87,7 @@ A pull request is _author ready_ when:
* There is a CI run in progress or completed.
* There is at least one collaborator approval.
* There are no outstanding review comments.
* There are no conflicts with the base branch.
Please always add the `author ready` label to the pull request in that case.
Please always remove it again as soon as the conditions are not met anymore.