Use gh v0.11.0 or later for the "shell" aliases.
Run the following gh alias set commands for each operation. You can confirm the created aliases with gh alias list.
gh alias set listMilestones "api graphql -F owner=':owner' -F name=':repo' -f query='
    query ListMilestones(\$name: String\!, \$owner: String\!) {
        repository(owner: \$owner, name: \$name) {
            milestones(first: 100) {
                nodes {
                    title
                    number
                    description
                    dueOn
                    url
                    state
                    closed
                    closedAt
                    updatedAt
                }
            }
        }
    }
'"gh alias set --shell viewMilestone "gh api graphql -F owner=':owner' -F name=':repo' -F number=\$1 -f query='
    query GetMilestones(\$name: String\!, \$owner: String\!, \$number: Int\!) {
        repository(owner: \$owner, name: \$name) {
            milestone(number: \$number) {
                title
                number
                description
                dueOn
                url
                state
                closed
                closedAt
                updatedAt
                issues(first: 100) {
                    nodes {
                        title
                        number
                        url
                        state
                    }
                }
                pullRequests(first: 100) {
                    nodes {
                        title
                        number
                        url
                        state
                    }
                }
            }
        }
    }
'"gh alias set --shell createMilestone "gh api --method POST repos/:owner/:repo/milestones --input - | jq '{ html_url: .html_url, state: .state, created_at: .created_at }'"Provide inputs from stdin.
echo '{
  "title": "Create a miletsone via gh",
  "state": "open",
  "due_on": "2020-12-31T23:59:59Z",
  "description": "Description foo bar"
}' | gh createMilestone
(I coundn't figure out a way to use gh alias arguments for title, due_on and description...)
gh alias set --shell closeMilestone "echo '{\"state\": \"closed\"}' | gh api --method PATCH repos/:owner/:repo/milestones/\$1 --input - | jq '{ html_url: .html_url, state: .state, closed_at: .closed_at }'"gh alias set --shell reopenMilestone "echo '{\"state\": \"open\"}' | gh api --method PATCH repos/:owner/:repo/milestones/\$1 --input - | jq '{ html_url: .html_url, state: .state, updated_at: .updated_at }'"gh alias set --shell deleteMilestone "gh api --method DELETE repos/:owner/:repo/milestones/\$1"
I am trying to do
pseudogh milestone add 5 6 7 8 9 do you think it should be possible to do that ??I have 100 PR (for each day of #100DaysOfCode) and I have fifteen milestone's (one for each week of the project) I want to set each of my 100 PR to the according milestone and don't feel like doing it 100 times on the web site...
Originally posted by @Luxcium in cli/cli#1200 (comment)