Last active
November 8, 2025 04:30
-
-
Save donaldguy/c89d1e0264815e3f997b0fb13b1e7f9c to your computer and use it in GitHub Desktop.
GraphQL calls for adding repos to star lists
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
| gh-starlists() { | |
| gh api graphql --paginate --raw-field query=' | |
| query($endCursor: String) { | |
| viewer { | |
| lists(first: 100, after: $endCursor) { | |
| nodes { | |
| id | |
| name | |
| } | |
| pageInfo { | |
| hasNextPage | |
| endCursor | |
| } | |
| } | |
| } | |
| }' \ | |
| --jq '.data.viewer.lists.nodes[] | |
| | "\(.id)\t\(.name)"'| column -s $'\t' -t | |
| } | |
| gh-repo-id() { | |
| gh api graphql -F o="${1%/*}" -F n="${1#*/}" -H X-Github-Next-Global-ID:1 \ | |
| -f query=' | |
| query ($o: String!, $n: String!) { | |
| repository(owner: $o, name: $n) { | |
| id | |
| } | |
| }' \ | |
| --jq '.data.repository.id' | |
| } | |
| gh-mv-repo-to-list() { | |
| if ! echo "$1" | grep -q '^R_' ; then | |
| printf "1st argument should be a GraphQL Repository.ID, starting with R_\ngot '%s'\n" $1 >&2; return 1 | |
| fi | |
| if ! echo "$2" | grep -q '^UL_' ; then | |
| printf "2nd argument should be a GraphQL UserList.ID, starting with UL_\ngot '%s'\n" $2 >&2; return 1 | |
| fi | |
| gh api graphql -F l="$2" -F r="$1" -f query=' | |
| mutation ($l: ID!, $r: ID!) { | |
| updateUserListsForItem(input:{ | |
| itemId: $r | |
| listIds: [$l] | |
| }) { | |
| lists {name} | |
| } | |
| }' \ | |
| --jq '"repo now [only] on list: \([ .data.updateUserListsForItem.lists[].name ]| join(", "))"' | |
| } |
Author
Author
Oh man, "fun" thing about going through this GraphQL mutation as of 8:30pm PST on September 7th :
It adds to list without actually starring
(ime w/ all official clients, including today with mobile apps, starring has been considered implied by just unfurling and choosing a list ;
and indeed right now still on web, un-starring removes from all lists, as a confirm modal will warn you/confirm.
I really thought they'd have this in the business logic too, but:
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case I want these after https://github.com/orgs/community/discussions/179038 and https://github.com/orgs/community/discussions/178947 are resolved
… for some reason