UP | HOME

NOTE: rename the title of Utterances issues

Rename the title of Utterances issues can be helpful when moving site to different URL, the following code is how can we make it.

read -p "current URL of site? " current_site_url
read -p "new URL of site? " new_site_url

if [ -z ${current_site_url} ]; then exit 0; fi
if [ -z ${new_site_url} ]; then exit 0; fi

gh issue list --label Utterances --json number,title --jq '.[] | [.title, .number] | @tsv' |
    while IFS=$'\t' read -r title number; do
        echo "Handle issue ${number}..."
        new_title=$(echo ${title} | sed "s/${current_site_url}/${new_site_url}/g")
        gh issue edit ${number} --title ${new_title}
        echo "Rename ${title} to ${new_title}"
    done

Date: 2022-07-04 Mon 00:00

Author: Lîm Tsú-thuàn