Lab Notes
Transfer Git Hub Issues in Bulk Between Repositories
This snippet is for when you need to transfer multiple issues from one GitHub repo to another.
First, make sure you’re have Github CLI installed.
in my case I installed it on my mac using:
brew install gh
Then I navigated to the project folder for the repo I wanted to transfer from and ran the following:
gh api -X GET repos/{your-org}/{repo-to-transfer-from}/issues -f pulls=false -f direction=asc -f state=all --jq '.[].number' --paginate | xargs -n 1 -I num gh issue transfer num https://github.com/{your-org}/{repo-to-transfer-to}
This created all the issues from my old repo to my new one in one go. The snippet can be adapted to perform other tasks in bulk using Github CLI – moving PRs for example.