Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/author-ready-conflicts.yml
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions doc/contributing/collaborator-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading