# GitHub Cli Exercises

# get-lab-names

Using the GH REST API, make a gh alias get-lab-names to get the names of the repos inside an organization sorted by last push

See

  1. Section GH REST API
  2. Section Exercise: Search for repos inside an organization inside the section gh Alias

# Issues of a repo

Using the GH REST API, make a gh alias repo-issues-get to get the issues of a repo. See

# Create repo

Using the GH REST API, make a gh alias repo-create to create a repo. See section POST Example: Create a Repo

# List all repos in an organization

Using the GH REST API, make a gh alias org-repos-list to list all repos in an organization. See section Pagination of the GH REST API chapter

# Formatted Issue list

Using the GH REST API and a Go template, make a gh alias repo-issues-list to list all issues of a repo in a formatted way.

See section Templates for the output

# Number of repos in an organization using GraphQL

Using the GH GraphQL API write a gh extension org-num-repos to count the number of repos in an organization. See section Example: Number of repos in an Organization

# Get the Issues

Using the GH GraphQL API write a gh alias repo-issues-get to get the issues of a repo. See the section Getting issues

A solution is in folder learning-graphql-with-gh/gh-graphql-connection-example (opens new window)

# List all repos in an organization with GraphQL

Using the GH GraphQL API, make a gh extension org-repos-list to list all repos in an organization. See section Pagination of the GH GraphQL API chapter

See a solution at folder learning-graphql-with-gh/org-getallrepos-graphql-pagination (opens new window)

# Add a Reaction

Using the GH GraphQL API write a gh alias issue-add-reaction to

  1. find an issue of a given repo by number and
  2. adds a given reaction to the issue.

See the section Mutation of the GraphQL Examples chapter

A solution is at folder /learning-graphql-with-gh/addreactiontoissue (opens new window)

# Rename a repo

Using the GH GraphQL API write a gh alias repo-rename to rename a repo.

See the sections Mutation and the section Rename Repository of the GraphQL Examples chapter

See folder learning-graphql-with-gh/repo-rename-mutation (opens new window) for a solution

# Add a Reply to a Comment in a Discussion

Using the GH GraphQL API write gh scripts to

  • Get the discussions of some repo
  • Get the comments in a discussion
  • Add a reply to a comment in a discussion

See the sections

of the GraphQL Examples chapter

See also learning-graphql-with-gh/discussions-mutation (opens new window) for a solution to the exercise

# References

Grading Rubric#

Comments#

Last Updated: 2 months ago