Skip to content

Instantly share code, notes, and snippets.

@fabiand
Created March 25, 2019 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiand/b5f3008c593760a7e9fbd32afdfd9215 to your computer and use it in GitHub Desktop.
Save fabiand/b5f3008c593760a7e9fbd32afdfd9215 to your computer and use it in GitHub Desktop.
#!/bin/bash
export LC_ALL=C
_api() { curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/$1 ; }
_org() { _api orgs/kubevirt/$1 ; }
_repos() { _api repos/kubevirt/$1 ; }
_kubevirt_pulls() { _repos kubevirt/pulls ; }
#_kubevirt_pulls | jq ".[] | select((.assignees | length) == 0).issue_url" ; exit
REPOS="$(_org repos)"
repos() { cat <<<$REPOS ; }
date
K_STARS=$(repos | jq '.[] | select(.name == "kubevirt").stargazers_count')
#echo "All stars"
ORG_STARS=$(repos | jq 'reduce .[].stargazers_count as $item (0; . + $item)')
K_FORKS=$(repos | jq '.[] | select(.name == "kubevirt").forks_count')
#echo "All forks"
ORG_FORKS=$(repos | jq 'reduce .[].forks_count as $item (0; . + $item)')
echo -e "$(date +%d-%b-%Y)\tTBD\t$K_STARS\t$ORG_STARS\t$K_FORKS\t$ORG_FORKS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment