Skip to content

Instantly share code, notes, and snippets.

@goatgoose
Created May 23, 2024 19:06
Show Gist options
  • Save goatgoose/05ae12b51a4739869323a5b61e54c1c7 to your computer and use it in GitHub Desktop.
Save goatgoose/05ae12b51a4739869323a5b61e54c1c7 to your computer and use it in GitHub Desktop.
#!/bin/bash
purge_before_date="2022-01-01"
labels_to_remove=("priority/high", "priority/medium")
for label in "${labels_to_remove[@]}"; do
echo "Removing ${label} labels:"
echo ""
issues_json=$(gh issue list -S "is:open is:issue label:${label} created:<${purge_before_date}" --limit 200 --json number,title)
while read issue_json; do
number=$(echo "${issue_json}" | jq -r ".number")
title=$(echo "${issue_json}" | jq -r ".title")
gh issue edit "${number}" --remove-label "${label}"
echo "${number}: ${title}"
sleep 1
done < <(echo "${issues_json}" | jq -c ".[]")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment