Created
February 1, 2022 11:00
-
-
Save joneff/93f0a24d4c5fd98a7b8d1875c84d6af8 to your computer and use it in GitHub Desktop.
A collection of scripts for working with gh cli, issues and projects beta
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
# remove all theme related labels from issues with multiple theme labels | |
gh pr list --state closed --limit 1000 --json number --jq ".[] | .number" | xargs -I {} gh pr edit {} --remove-label T:Default,T:Bootstrap,T:Material,T:Classic | |
# get project ID by ORG and NUMBER | |
gh api graphql -f query=' | |
query{ | |
organization(login: "ORG"){ | |
projectNext(number: NUMBER) { | |
id | |
} | |
} | |
}' | |
# add all closed issues to a project with a given ID | |
gh issue list --state closed --limit 4000 --json id --jq ".[] | .id" | xargs -I {} gh api graphql -f query=' | |
mutation { | |
addProjectNextItem( | |
input: { | |
projectId: "PROJECT_ID" | |
contentId: "{}" | |
} | |
) { | |
projectNextItem { | |
id | |
} | |
} | |
}' | |
# delete items from project | |
gh api graphql -f query=' | |
query($org: String!, $number: Int!) { | |
organization(login: $org){ | |
projectNext(number: $number) { | |
id | |
items(first:100) { | |
nodes { | |
id | |
title | |
} | |
} | |
} | |
} | |
}' -f org=ORG -F number=NUMBER | \ | |
jq '.data.organization.projectNext.items.nodes | .[].id' | \ | |
xargs -I {} gh api graphql -f query=' | |
mutation { | |
deleteProjectNextItem( | |
input: { | |
projectId: "ID" | |
itemId: "{}" | |
} | |
) { | |
deletedItemId | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment