Closed ShanaLMoore closed 2 months ago
Notes:
#!/bin/bash
# Repository details
REPO="scientist-softserv/adventist-dl"
# File path to the JSON file containing the issues
JSON_FILE="issues.json"
# Fetch issues from GitHub and save them to a JSON file
gh issue list --json id,number,projectItems -R $REPO --limit 1000 > $JSON_FILE
# Check if JSON file was created successfully
if [ ! -f "$JSON_FILE" ]; then
echo "Failed to fetch issues or create JSON file: $JSON_FILE"
exit 1
fi
# Environment variable for the JSON file with filtered issues
ISSUES_JSON="filtered_issues.json"
# Using jq to filter issues which are part of 'adventist-dl' but not part of 'Adventist Knapsack'
jq '[.[] | select(.projectItems | any(.title == "adventist-dl") and all(.title != "Adventist Knapsack"))]' $JSON_FILE > $ISSUES_JSON
# Check if filtered JSON file exists
if [ ! -f "$ISSUES_JSON" ]; then
echo "JSON file not found: $ISSUES_JSON"
exit 1
fi
# Iterate over each issue number in the filtered JSON file
jq -r '.[].number' $ISSUES_JSON | while read ISSUE_NUMBER; do
# Remove the issue from "adventist-dl" project
# gh issue edit $ISSUE_NUMBER -R $REPO --remove-project "adventist-dl"
# echo "Removed 'adventist-dl' from Issue #$ISSUE_NUMBER."
# Add the issue to "Adventist Knapsack" project
gh issue edit $ISSUE_NUMBER -R $REPO --add-project "Adventist Knapsack"
echo "Added 'Adventist Knapsack' to Issue #$ISSUE_NUMBER."
done
Transfer all remaining adventist related tickets to an adventist knapsack repo.