GitHub CLI

GitHub CLI를 이용하면 GitHub 관리 자동화 스크립트를 만들 수 있다.

  • GitHub CLI : https://cli.github.com/
  • GitHub CLI commands : https://cli.github.com/manual/gh
  • GitHub REST API : https://docs.github.com/en/rest
# 로그인
gh auth login

# 저장소 리스트 조회
gh repo list

# gist 리스트 조회
gh gist list

저장소 리스트

  • 저장소 명령 도움말 : https://cli.github.com/manual/gh_repo
# 저장소 리스트 (Fork 제외, 모든 필드, JSON 출력)
gh repo list --source --json archivedAt,assignableUsers,codeOfConduct,contactLinks,createdAt,defaultBranchRef,deleteBranchOnMerge,description,diskUsage,forkCount,fundingLinks,hasDiscussionsEnabled,hasIssuesEnabled,hasProjectsEnabled,hasWikiEnabled,homepageUrl,isArchived,isBlankIssuesEnabled,isEmpty,isFork,isInOrganization,isMirror,isPrivate,isSecurityPolicyEnabled,isTemplate,isUserConfigurationRepository,issueTemplates,issues,labels,languages,latestRelease,licenseInfo,mentionableUsers,mergeCommitAllowed,milestones,mirrorUrl,name,nameWithOwner,openGraphImageUrl,owner,parent,primaryLanguage,projects,pullRequestTemplates,pullRequests,pushedAt,rebaseMergeAllowed,repositoryTopics,securityPolicyUrl,squashMergeAllowed,sshUrl,stargazerCount,templateRepository,updatedAt,url,usesCustomOpenGraphImage,viewerCanAdminister,viewerDefaultCommitEmail,viewerDefaultMergeMethod,viewerHasStarred,viewerPermission,viewerPossibleCommitEmails,viewerSubscription,visibility,watchers

# 저장소 리스트 (Fork 제외, 일부 필드, JSON 출력)
gh repo list --source --json name,description,isPrivate,hasProjectsEnabled,hasWikiEnabled,homepageUrl,url,createdAt,updatedAt

# 저장소 리스트 (Fork 제외, 일부 필드, 리스트 출력)
gh repo list --source --json nameWithOwner,description,isPrivate,createdAt,updatedAt --template "{{range .}}{{tablerow .nameWithOwner .description .isPrivate .createdAt .updatedAt}}{{end}}"