From 968f67b5e88e05dd3b1ce5e240f0b8f9467805fc Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 23 Nov 2025 12:18:00 +0100 Subject: [PATCH 1/5] tools: add a script to help with nomination --- GOVERNANCE.md | 6 +++ tools/actions/nominate.sh | 80 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100755 tools/actions/nominate.sh diff --git a/GOVERNANCE.md b/GOVERNANCE.md index a1fd4148aaeed4..7989e72c141268 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -269,6 +269,12 @@ Example of list of contributions: organization * Other participation in the wider Node.js community +You can use the ad-hoc script to use `gh` to open the private discussion: + +```sh +./tools/actions/nominate.sh GITHUB_ID +``` + The nomination passes if no collaborators oppose it (as described in the following section) after one week. In the case of an objection, the TSC is responsible for working with the individuals involved and finding a resolution. diff --git a/tools/actions/nominate.sh b/tools/actions/nominate.sh new file mode 100755 index 00000000000000..102a28698bb086 --- /dev/null +++ b/tools/actions/nominate.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +set -ex + +ORG=nodejs +REPO=collaborators + +prepare_collaborator_nomination() { + HANDLE="$1" + + [ -n "$HANDLE" ] || { + echo "Missing handle" >&2 + return 1 + } + + BODY_FILE=$(mktemp) + cat -> "$BODY_FILE" < + +* Commits in the nodejs/node repository: https://github.com/nodejs/node/commits?author=$HANDLE +* Pull requests and issues opened in the nodejs/node repository: https://github.com/nodejs/node/issues?q=author:$HANDLE +* Comments on pull requests and issues in the nodejs/node repository: https://github.com/nodejs/node/issues?q=commenter:$HANDLE +* Reviews on pull requests in the nodejs/node repository: https://github.com/nodejs/node/pulls?q=reviewed-by:$HANDLE +* Pull requests and issues opened throughout the Node.js organization: https://github.com/search?q=author:$HANDLE+org:$ORG +* Comments on pull requests and issues throughout the Node.js organization: https://github.com/search?q=commenter:$HANDLE+org:$ORG + + + +EOF + $EDITOR "$BODY_FILE" + BODY="$(cat "$BODY_FILE")" + rm "$BODY_FILE" + + [ -n "$BODY" ] || { + echo "Empty body" >&2 + return 1 + } + + echo "Getting repo ID and discussion category" >&2 + REPO_ID_AND_DISCUSSION_CATEGORY_ID="$(gh api graphql -f query=' + query($owner:String!,$repo:String!){ + repository(owner:$owner,name:$repo){ + id + discussionCategories(first:100){ + nodes{ id name } + } + } + }' -F owner="$ORG" -F repo="$REPO" --jq '[ + .data.repository.id, + (.data.repository.discussionCategories.nodes[] | select(.name=="Collaborator nominations") | .id) + ] | @tsv')" + REPO_ID=$(echo "$REPO_ID_AND_DISCUSSION_CATEGORY_ID" | cut -f1) + [ -n "$REPO_ID" ] || { + echo "Cannot find repo ID" >&2 + return 1 + } + CATEGORY_ID=$(echo "$REPO_ID_AND_DISCUSSION_CATEGORY_ID" | cut -f2) + [ -n "$CATEGORY_ID" ] || { + echo "Missing discussion category ID" >&2 + return 1 + } + + gh api graphql -f query=' + mutation($repo: ID!,$cat: ID!,$title: String!,$body: String!){ + createDiscussion(input: { + repositoryId: $repo + categoryId: $cat + title: $title + body: $body + }){ discussion { url } } + }' \ + -F repo="$REPO_ID" -F cat="$CATEGORY_ID" -F title="Nominating ${HANDLE}?" -F body="$BODY" +} + +prepare_collaborator_nomination "$1" From 299163734f5bf6f738f6d8892e3649591a6b33d5 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 23 Nov 2025 12:37:46 +0100 Subject: [PATCH 2/5] fixup! tools: add a script to help with nomination --- tools/actions/nominate.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/actions/nominate.sh b/tools/actions/nominate.sh index 102a28698bb086..97063bd3f39c5a 100755 --- a/tools/actions/nominate.sh +++ b/tools/actions/nominate.sh @@ -32,7 +32,7 @@ prepare_collaborator_nomination() { * Other participation in the wider Node.js community --> EOF - $EDITOR "$BODY_FILE" + ${EDITOR:-nano} "$BODY_FILE" BODY="$(cat "$BODY_FILE")" rm "$BODY_FILE" @@ -42,6 +42,7 @@ EOF } echo "Getting repo ID and discussion category" >&2 + # shellcheck disable=SC2016 REPO_ID_AND_DISCUSSION_CATEGORY_ID="$(gh api graphql -f query=' query($owner:String!,$repo:String!){ repository(owner:$owner,name:$repo){ @@ -65,6 +66,7 @@ EOF return 1 } + # shellcheck disable=SC2016 gh api graphql -f query=' mutation($repo: ID!,$cat: ID!,$title: String!,$body: String!){ createDiscussion(input: { From cbb129c524bd53708aa06529685f8cf4a8982b2a Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 23 Nov 2025 20:25:58 +0100 Subject: [PATCH 3/5] Update GOVERNANCE.md --- GOVERNANCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 7989e72c141268..001384b81fe604 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -271,7 +271,7 @@ Example of list of contributions: You can use the ad-hoc script to use `gh` to open the private discussion: -```sh +```bash ./tools/actions/nominate.sh GITHUB_ID ``` From 4dbc412d65a51775f4d9f7ef696386d1ee65d18d Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 25 Nov 2025 11:24:38 +0100 Subject: [PATCH 4/5] fixup! fixup! tools: add a script to help with nomination add confirm prompt before opening the discussion --- tools/actions/nominate.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/actions/nominate.sh b/tools/actions/nominate.sh index 97063bd3f39c5a..816f38a3834bff 100755 --- a/tools/actions/nominate.sh +++ b/tools/actions/nominate.sh @@ -41,6 +41,16 @@ EOF return 1 } + read -p 'Open the discussion using `gh`? (y/N)' -n 1 -r + echo + if ! ([ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]); then + set +x + echo "Here's the body that you set:" >&2 + echo "$BODY" + echo "Open https://github.com/nodejs/collaborators/discussions/new/choose in your browser to create the discussion manually" >&2 + return 0 + fi + echo "Getting repo ID and discussion category" >&2 # shellcheck disable=SC2016 REPO_ID_AND_DISCUSSION_CATEGORY_ID="$(gh api graphql -f query=' From 0bfa8c9b52d359fab9c071d76d96ba2be00aeb01 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 25 Nov 2025 12:02:12 +0100 Subject: [PATCH 5/5] fixup! fixup! fixup! tools: add a script to help with nomination --- tools/actions/nominate.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/actions/nominate.sh b/tools/actions/nominate.sh index 816f38a3834bff..ef5c54556779fe 100755 --- a/tools/actions/nominate.sh +++ b/tools/actions/nominate.sh @@ -41,7 +41,9 @@ EOF return 1 } - read -p 'Open the discussion using `gh`? (y/N)' -n 1 -r + # shellcheck disable=SC2016 + printf 'Open the discussion using `gh`? (y/N) ' >&2 + read -r REPLY echo if ! ([ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]); then set +x