Forked from dllopis-sfdc/gh_cli_archive_unarchive_repository.bash
Created
March 3, 2025 09:19
-
-
Save morisono/31a153c4b406f6a888839b36d2226af0 to your computer and use it in GitHub Desktop.
How to archive / unarchive a repository with GitHub CLI
This file contains 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
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