Skip to content

Instantly share code, notes, and snippets.

@bertfrees
Created January 31, 2017 11:26
Show Gist options
  • Save bertfrees/80c05150751c8097e760953f7c60c9a6 to your computer and use it in GitHub Desktop.
Save bertfrees/80c05150751c8097e760953f7c60c9a6 to your computer and use it in GitHub Desktop.
Create the same milestone in several repositories at once
#!/usr/bin/env bash
set -e
title=$1
if [ -z "$title" ]; then
echo "Please specify a milestone title" >&2
exit 1
fi
shift
due_on=$1
if [ -z "$due_on" ]; then
echo "Please specify a due date" >&2
exit 1
fi
# need gdate on Mac OS, can use standard date on Linux:
due_on=$( gdate -d "$due_on" +"%Y-%m-%dT07:00:00Z" )
shift
description=$1
# replace with your user name:
user=bertfrees
# following requires that you manage your password with pass
# (https://www.passwordstore.org), use alternative below otherwise:
password=$( pass github.com | head -n1 )
# password=foo
# read -s -p "Enter Password: " password
repos=(
pipeline-assembly
pipeline-cli
pipeline-framework
pipeline-gui
pipeline-mod-audio
pipeline-mod-braille
pipeline-mod-nlp
pipeline-mod-tts
pipeline-modules-common
pipeline-scripts
pipeline-scripts-utils
pipeline-tasks
pipeline-updater
pipeline-updater-gui
pipeline-webui
)
for repo in "${repos[@]}"
do
jq -nc --arg title "$title" \
--arg description "$description" \
--arg state "open" \
--arg due_on "$due_on" \
'{"title":$title, "state":$state, "description":$description, "due_on":$due_on}' \
| curl -u "$user:$password" -X POST --data @- \
https://api.github.com/repos/daisy/$repo/milestones
done
# Done:
# ./create_milestones.sh "Februari 2017" 2017-02-28
# ./create_milestones.sh "March 2017" 2017-03-31
# ./create_milestones.sh "April 2017" 2017-04-30
# ./create_milestones.sh "May 2017" 2017-05-31 "Milestone May 2017 according to DAISY Pipeline workplan 2016-17"
# ./create_milestones.sh "June 2017" 2017-06-30
# ./create_milestones.sh "July 2017" 2017-07-31
# ./create_milestones.sh "August 2017" 2017-08-31
# ./create_milestones.sh "September 2017" 2017-09-30
# ./create_milestones.sh "October 2017" 2017-10-31 "Milestone October 2017 according to DAISY Pipeline workplan 2017"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment