-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
tools: add a script to help with nomination #60824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aduh95
wants to merge
5
commits into
nodejs:main
Choose a base branch
from
aduh95:nominate-with-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+100
−0
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
968f67b
tools: add a script to help with nomination
aduh95 2991637
fixup! tools: add a script to help with nomination
aduh95 cbb129c
Update GOVERNANCE.md
aduh95 4dbc412
fixup! fixup! tools: add a script to help with nomination
aduh95 0bfa8c9
fixup! fixup! fixup! tools: add a script to help with nomination
aduh95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| #!/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" <<EOF | ||
| <!-- Consider writing a small intro on the contributor and their contributions --> | ||
|
|
||
| * 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 | ||
|
|
||
| <!-- You can add more item to that lists, such as: --> | ||
| <!-- | ||
| * Help provided to end-users and novice contributors | ||
| * Participation in other projects, teams, and working groups of the Node.js | ||
| organization | ||
| * Other participation in the wider Node.js community | ||
| --> | ||
| EOF | ||
| ${EDITOR:-nano} "$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 | ||
| # shellcheck disable=SC2016 | ||
| 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 | ||
| } | ||
|
|
||
| # shellcheck disable=SC2016 | ||
| 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" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.