Last active
July 6, 2021 20:03
-
-
Save tichnas/14d254e24c805c57cdb6d905e21bddfb to your computer and use it in GitHub Desktop.
Duplicate milestones from one repo to another.
This file contains hidden or 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 | |
| source="$1" | |
| destination="$2" | |
| cwd="$PWD" | |
| cd "$source" | |
| milestones=$(gh listMilestones | jq ".data.repository.milestones.nodes" | jq -c ".[]") | |
| cd "$cwd" | |
| cd "$destination" | |
| for milestone in $milestones; do | |
| parsed=$(echo $milestone | jq -c "{title: .title, state: .state | ascii_downcase, due_on: .dueOn, description: .description}") | |
| echo "$parsed" | gh createMilestone | |
| done | |
| cd "$cwd" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites:
Usage:
./duplicateMilestones.sh <source> <destination>, where<source>and<destination>are paths of source repo and destination repo respectively.Setting permanent gh alias
gh alias set --shell replicateMilestones '<paste>'(don't forget the quotes around the whole script)gh replicateMilestones <source> <destination>