| 1 | #!/bin/bash |
| 2 | set -eu |
| 3 | |
| 4 | update_label() { |
| 5 | # $1 is a username |
| 6 | USER=$1 |
| 7 | # $2 is a cutoff date; use $(date +%Y-%m-%d) for now |
| 8 | DATE=$2 |
| 9 | |
| 10 | gh api -X GET search/issues -f q="repo:aws/s2n-tls is:open -label:s2n-core author:${USER} created:<${DATE}" > ${USER}.json |
| 11 | jq -c -r '.items|.[]|.number' $USER.json > ${USER}_ISSUES.log |
| 12 | if [ $(cat ${USER}_ISSUES.log|wc -l) -eq 0 ]; then |
| 13 | echo "No issues for ${USER}" |
| 14 | return |
| 15 | fi |
| 16 | echo "Found $(cat ${USER}_ISSUES.log|wc -l) issues for $USER, continue?" |
| 17 | read |
| 18 | for issue in $(cat ${USER}_ISSUES.log); do |
| 19 | echo "Updating $issue" |
| 20 | echo '["s2n-core"]'| gh api --silent -X POST repos/aws/s2n-tls/issues/$issue/labels --input - |
| 21 | done |
| 22 | echo "Done with $USER" |
| 23 | } |
| 24 | |
| 25 | internal="toidiu |
| 26 | zaherd |
| 27 | NLMalloy |
| 28 | ttjsu-aws |
| 29 | rday |
| 30 | agray256 |
| 31 | tawdry-audrey |
| 32 | salusasecondus |
| 33 | dougch |
| 34 | lrstewart |
| 35 | goatgoose |
| 36 | camshaft |
| 37 | maddeleine |
| 38 | WesleyRosenblum" |
| 39 | |
| 40 | maint="colmmacc |
| 41 | alexw91 |
| 42 | baldwinmatt |
| 43 | soco |
| 44 | alexeblee" |
| 45 | |
| 46 | for USER in ${internal}; do |
| 47 | update_label ${USER} $(date +%Y-%m-%d) |
| 48 | done |
| 49 | |
| 50 | for USER in ${maint}; do |
| 51 | update_label ${USER} 2019-10-23 |
| 52 | done |