Skip to content

Instantly share code, notes, and snippets.

@dllopis-sfdc
Last active October 11, 2021 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dllopis-sfdc/94a4b3be12f5f2e8ea42e9a382aee800 to your computer and use it in GitHub Desktop.
Save dllopis-sfdc/94a4b3be12f5f2e8ea42e9a382aee800 to your computer and use it in GitHub Desktop.
How to archive / unarchive a repository with GitHub CLI
REPO_NAME=condition-jenkins
REPO_ID=$(gh api graphql -q '.data.repository.id' -f query="query {repository(owner: \"krux\", name: \"${REPO_NAME}\") {id}}")
# unarchive:
gh api graphql --silent -f query="mutation {archiveRepository(input: {repositoryId: \"${REPO_ID}\"}){clientMutationId}}"
# archive
gh api graphql --silent -f query="mutation {unarchiveRepository(input: {repositoryId: \"${REPO_ID}\"}){clientMutationId}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment