@@ -59,51 +59,48 @@ limit_issue_pagination () {
5959
6060repo_issues () {
6161 for PAGE in $( limit_issue_pagination) ; do
62- for i in $( curl -s -H " Authorization: token ${GITHUB_TOKEN} " " ${API_URL_PREFIX} /repos/${ORG} /${REPO} /issues?state=all&labels=Linked%20[AC]&page=${PAGE} &per_page=100" | jq -r ' map(select(.created_at | . >= "' " ${MONTH_START} " ' T00:00" and . <= "' " ${MONTH_END} " ' T23:59")) | sort_by(.number) | .[] | .number' ) ; do
63- ISSUE_PAYLOAD=$( curl -s -H " Authorization: token ${GITHUB_TOKEN} " " ${API_URL_PREFIX} /repos/${ORG} /${REPO} /issues/${i} " -H " Accept: application/vnd.github.mercy-preview+json" )
64- ISSUE_TIMELINE_PAYLOAD=$( curl -s -H " Authorization: token ${GITHUB_TOKEN} " " ${API_URL_PREFIX} /repos/${ORG} /${REPO} /issues/${i} /timeline" -H " Accept: application/vnd.github.mockingbird-preview+json" | jq -r ' .[] | select(.label.name=="Linked [AC]" or .label.name=="linked")' )
65-
66- ISSUE_AUTHOR=$( echo " ${ISSUE_PAYLOAD} " | jq -r .user.login)
67- ISSUE_TITLE=$( echo " ${ISSUE_PAYLOAD} " | jq -r .title | tr ' "' " '" )
68- ISSUE_HTML_URL=$( echo " ${ISSUE_PAYLOAD} " | jq -r .html_url)
62+ for i in $( curl -s -H " Authorization: token ${GITHUB_TOKEN} " " ${API_URL_PREFIX} /repos/${ORG} /${REPO} /issues?state=all&labels=Linked%20[AC]&page=${PAGE} &per_page=100" | jq -r ' map(select(.created_at | . >= "' " ${MONTH_START} " ' T00:00" and . <= "' " ${MONTH_END} " ' T23:59")) | sort_by(.number) | .[] | .number' ) ; do
63+ ISSUE_PAYLOAD=$( curl -s -H " Authorization: token ${GITHUB_TOKEN} " " ${API_URL_PREFIX} /repos/${ORG} /${REPO} /issues/${i} " -H " Accept: application/vnd.github.mercy-preview+json" )
64+ ISSUE_TIMELINE_PAYLOAD=$( curl -s -H " Authorization: token ${GITHUB_TOKEN} " " ${API_URL_PREFIX} /repos/${ORG} /${REPO} /issues/${i} /timeline" -H " Accept: application/vnd.github.mockingbird-preview+json" | jq -r ' .[] | select(.label.name=="Linked [AC]" or .label.name=="linked")' )
65+
66+ ISSUE_AUTHOR=$( echo " ${ISSUE_PAYLOAD} " | jq -r .user.login)
67+ ISSUE_TITLE=$( echo " ${ISSUE_PAYLOAD} " | jq -r .title | tr ' "' " '" )
68+ ISSUE_HTML_URL=$( echo " ${ISSUE_PAYLOAD} " | jq -r .html_url)
6969
70- ISSUE_TIMELINE_LABELED_BY=$( echo " ${ISSUE_TIMELINE_PAYLOAD} " | jq -s ' first(.[]| .actor.login)' | jq -r)
70+ ISSUE_TIMELINE_LABELED_BY=$( echo " ${ISSUE_TIMELINE_PAYLOAD} " | jq -s ' first(.[]| .actor.login)' | jq -r)
7171
72- cat >> test.json << EOF
72+ cat >> test.json << EOF
7373{
7474 "author": "${ISSUE_AUTHOR} ",
7575 "title": "${ISSUE_TITLE} ",
7676 "issue_url": "${ISSUE_HTML_URL} ",
7777 "contributor": "${ISSUE_TIMELINE_LABELED_BY} "
7878}
7979EOF
80-
81- done
80+ done
8281 done
8382}
8483
8584author_json () {
8685 AUTHORS=$( cat test.json | jq -r ' .author' | sort | uniq -c | awk -F " " ' {print "{\"author\":""\""$2"\""",\"count\":" $1"}"}' | jq -r .author)
87- for AUTHOR in ${AUTHORS} ; do
86+ for AUTHOR in ${AUTHORS} ; do
8887 TEST_PAYLOAD=$( cat test.json | jq -r ' .author' | sort | uniq -c | awk -F " " ' {print "{\"author\":""\""$2"\""",\"count\":" $1"}"}' | jq -r .)
8988 TEST_PAYLOAD_AUTHOR=$( echo " ${TEST_PAYLOAD} " | jq -r --arg AUTHOR " ${AUTHOR} " ' select(.author==$AUTHOR) | .author' )
9089 TEST_PAYLOAD_AUTHOR_COUNT=$( echo " ${TEST_PAYLOAD} " | jq -r --arg AUTHOR " ${AUTHOR} " ' select(.author==$AUTHOR) | .count' )
91- # TEST_PAYLOAD_AUTHOR_ISSUE_TITLE=$(cat test.json | jq -r --arg AUTHOR "${AUTHOR}" 'select(.author==$AUTHOR) | .title')
9290 TEST_PAYLOAD_AUTHOR_ISSUE_URL=$( cat test.json | jq -r --arg AUTHOR " ${AUTHOR} " ' select(.author==$AUTHOR) | .title, .issue_url' )
9391 echo -e " <a href=\" https://github.com/${TEST_PAYLOAD_AUTHOR} \" >${TEST_PAYLOAD_AUTHOR} </a> - ${TEST_PAYLOAD_AUTHOR_COUNT} "
94- done | sort -n -k 4,4 -r >> output.txt
92+ done | sort -n -k 4,4 -r >> output.txt
9593}
9694
9795contributor_json () {
9896 CONTRIBUTORS=$( cat test.json | jq -r ' .contributor' | sort | uniq -c | awk -F " " ' {print "{\"contributor\":""\""$2"\""",\"count\":" $1"}"}' | jq -r .contributor)
99- for CONTRIBUTOR in ${CONTRIBUTORS} ; do
97+ for CONTRIBUTOR in ${CONTRIBUTORS} ; do
10098 TEST_PAYLOAD=$( cat test.json | jq -r ' .contributor' | sort | uniq -c | awk -F " " ' {print "{\"contributor\":""\""$2"\""",\"count\":" $1"}"}' | jq -r .)
10199 TEST_PAYLOAD_CONTRIBUTOR=$( echo " ${TEST_PAYLOAD} " | jq -r --arg CONTRIBUTOR " ${CONTRIBUTOR} " ' select(.contributor==$CONTRIBUTOR) | .contributor' )
102100 TEST_PAYLOAD_CONTRIBUTOR_COUNT=$( echo " ${TEST_PAYLOAD} " | jq -r --arg CONTRIBUTOR " ${CONTRIBUTOR} " ' select(.contributor==$CONTRIBUTOR) | .count' )
103- # TEST_PAYLOAD_CONTRIBUTOR_ISSUE_TITLE=$(cat test.json | jq -r --arg CONTRIBUTOR "${CONTRIBUTOR}" 'select(.contributor==$CONTRIBUTOR) | .title' )
104101 TEST_PAYLOAD_CONTRIBUTOR_ISSUE_URL=$( cat test.json | jq -r --arg CONTRIBUTOR " ${CONTRIBUTOR} " ' select(.contributor==$CONTRIBUTOR) | .issue_url' )
105102 echo -e " <a href=\" https://github.com/${TEST_PAYLOAD_CONTRIBUTOR} \" >${TEST_PAYLOAD_CONTRIBUTOR} </a> - ${TEST_PAYLOAD_CONTRIBUTOR_COUNT} "
106- done | sort -n -k 4,4 -r >> output.txt
103+ done | sort -n -k 4,4 -r >> output.txt
107104 rm -Rf test.json
108105}
109106
0 commit comments