rwxrob-dot/gh/config.yml
2022-02-11 12:05:13 -05:00

42 lines
1.5 KiB
YAML

git_protocol: ssh
editor: vim
prompt: enabled
pager: less
aliases:
co: pr checkout
del: |
!gh api -X DELETE "repos/$GITUSER/$1"
priv: |
!gh api -X PATCH "repos/$GITUSER/$1" -f private="true" | jq .private
pub: |
!gh api -X PATCH "repos/$GITUSER/$1" -f private="false" | jq .private
status: |
!gh api graphql -f emoji="${1%% *}" -f msg="${1#* }" -f query='mutation ($msg: String!, $emoji: String) {changeUserStatus(input:{message:$msg,emoji:$emoji}) {status { message, emoji }}}'
repos: |
!gh api --paginate graphql -f owner="$1" -f query='
query($owner: String!, $per_page: Int = 100, $endCursor: String) {
repositoryOwner(login: $owner) {
repositories(first: $per_page, after: $endCursor, ownerAffiliations: OWNER) {
nodes { nameWithOwner }
pageInfo { hasNextPage endCursor }
}
}
}
' | jq -r '.data.repositoryOwner.repositories.nodes[].nameWithOwner' | sort
orgs: |
!gh api --paginate graphql -f query='
query {
viewer {
id
name
organizations(first: 100) {
nodes {
id
name
}
}
}
} ' | jq -r '.data.viewer.organizations[][] | .id + " " + .name'
defmain: |
!gh api -X PATCH "repos/$1" -f default_branch="main" | jq .default_branch