Last active
July 22, 2018 20:42
-
-
Save timja/4ad8253879391557edee6582c6fe2ed1 to your computer and use it in GitHub Desktop.
Rename moj repos to cnp
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
{"query":"{\n search(last: 100, type: REPOSITORY, query: \"user:hmcts moj\") {\n nodes {\n ... on Repository {\n name\n }\n }\n repositoryCount\n }\n}\n","variables":{},"operationName":null} |
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
#!/bin/bash | |
./all-moj-repos | jq -r .data.search.nodes[].name | xargs -I {} ./rename-repo {} |
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
#!/bin/bash | |
old_repo=$1 | |
new_repo=${old_repo/moj/cnp} | |
curl \ | |
-H "Authorization: Token ${GITHUB_AUTH}" \ | |
-H "Content-Type:application/json" \ | |
-H "Accept: application/json" \ | |
-X PATCH \ | |
--data '{ "name": "'${new_repo}'" }' \ | |
https://api.github.com/repos/hmcts/$old_repo |
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
#!/bin/bash | |
curl -H "Authorization: bearer $GITHUB_AUTH" -d @graphql.json https://api.github.com/graphql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment