Created
November 16, 2022 11:49
-
-
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
This file contains 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
#!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