Last active
January 12, 2022 16:23
-
-
Save pokey/a9bb9a201226f73ad3865bbb7754ba3c to your computer and use it in GitHub Desktop.
Bulk transfer all github issues from one repo to another, keeping labels intact
This file contains hidden or 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
#!/usr/bin/env bash | |
# Migrates all open issues from one repo to another, labeling them with the same labels, and adding a new label | |
# | |
# Assumes: | |
# - the target repo's labels are a superset of the source repo's | |
# - you have jq installed | |
# - you have gh installed | |
# | |
# Steps: | |
# 1. Change source_repo to your source repo, | |
# 2. Change target_repo in migrate-and-label.sh to your target repo, and | |
# 3. Change "talon" below to the label you want to add to all migrated issues | |
source_repo=pokey/cursorless-talon | |
gh issue list --repo $source_repo --json url,labels \ | |
| jq -r '.[]|{labels: ([.labels[].name, "talon"]|join(",")), url} | tojson | @sh' \ | |
| xargs -n1 ./migrate-and-label.sh |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Helper script used by `bulk-transfer-github-issues.sh` to migrate and label a single issue | |
# Expects single arg containing json object with url and comma-separated labels | |
target_repo=pokey/cursorless-vscode | |
input_issue_info="$1" | |
input_issue_url=$(echo "$input_issue_info" | jq -r '.url') | |
input_issue_labels=$(echo "$input_issue_info" | jq -r '.labels') | |
new_issue=$(gh issue transfer $input_issue_url $target_repo) | |
gh issue edit $new_issue --add-label "$input_issue_labels" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment