Skip to content

Instantly share code, notes, and snippets.

@timja
Last active July 22, 2018 20:42
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 timja/4ad8253879391557edee6582c6fe2ed1 to your computer and use it in GitHub Desktop.
Save timja/4ad8253879391557edee6582c6fe2ed1 to your computer and use it in GitHub Desktop.
Rename moj repos to cnp
{"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}
#!/bin/bash
./all-moj-repos | jq -r .data.search.nodes[].name | xargs -I {} ./rename-repo {}
#!/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
#!/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