Skip to content

Instantly share code, notes, and snippets.

@guseggert
Last active December 5, 2021 19:19
Show Gist options
  • Save guseggert/b9622b794b0886d66e8fbf8f234ca709 to your computer and use it in GitHub Desktop.
Save guseggert/b9622b794b0886d66e8fbf8f234ca709 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
from=$1
to=$2
while read -r issue_json; do
title=$(echo "$issue_json" | jq -r .title)
number=$(echo "$issue_json" | jq -r .number)
repo_name=$(basename "$from")
new_title="[${repo_name}] ${title}"
new_url=$(gh issue transfer --repo "$from" "$number" "$to")
new_number=$(basename "$new_url")
gh issue edit "$new_number" --repo "$to" --title "$new_title"
echo "Transferred '$title' from $from to $to: https://$to/issues/$new_number"
sleep 1
done < <(gh issue list --repo "$from" --json number,title --jq '.[]' -s open -L 10000)
@marten-seemann
Copy link

Should this also change the issue title, e.g. by prepending the name of the repo where this issue originated?

@guseggert
Copy link
Author

guseggert commented Dec 4, 2021

Good idea, thanks! Added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment