Skip to content

Instantly share code, notes, and snippets.

@harrism
Created November 16, 2022 11:49
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 harrism/b2e18151e445602c7a40a434e861d30c to your computer and use it in GitHub Desktop.
Save harrism/b2e18151e445602c7a40a434e861d30c to your computer and use it in GitHub Desktop.
Use the GitHub CLI to replace a label on all issues and PRs in a repo with another label
#!bin/bash
issues=`gh issue list -s all -l $1 --json number --jq '.[].number'`
echo Relabeling `echo $issues | wc -w` issues
for issue in $issues; do
gh issue edit --remove-label $1 $issue
gh issue edit --add-label $2 $issue
done
prs=`gh pr list -s all -l $1 --json number --jq '.[].number'`
echo Relabeling `echo $prs | wc -w` PRs
for pr in $prs; do
gh issue edit --remove-label $1 $pr
gh issue edit --add-label $2 $pr
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment