Created
December 8, 2021 09:50
-
-
Save superbrothers/511b21359faf35ae1321a5bc904d387c to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -e -o pipefail; [[ -n "$DEBUG" ]] && set -x | |
curl_opts=(--silent -L) | |
if [[ -n "$PAT" ]]; then | |
curl_opts+=(-H "Authorization: token $PAT") | |
fi | |
cat | while read line; do | |
pr_nums=($(echo "$line" | grep -o -e "#[0-9]\+" | cut -d"#" -f 2 ||:)) | |
if [[ "${#pr_nums[*]}" -eq 0 ]]; then | |
echo "$line" | |
continue | |
fi | |
sigs=() | |
for pr_num in "${pr_nums[@]}"; do | |
sigs+=( $(curl "${curl_opts[@]}" "https://api.github.com/repos/kubernetes/kubernetes/issues/${pr_num}/labels" | jq -r '.[] | select(.name | startswith("sig/")) | .name') ) | |
done | |
if [[ "${#sigs[*]}" -eq 0 ]]; then | |
echo "$line" | |
continue | |
fi | |
echo "$line [$(IFS=","; echo "${sigs[*]}")]" | |
done | |
# vim: ai ts=2 sw=2 et sts=2 ft=sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment