vim, gitconfig, update.sh
[dotfiles_afify.git] / .scripts / github_status
blob9eff8f5f1ffd8245a0de4cd65bfd37b44566fe37
1 #!/bin/sh
3 owner="afify"
4 repos_local_dir="/mnt/data/dev"
5 today=$(date +%Y_%m_%d)
6 save_at="/mnt/data/github"
7 output_file=$save_at/$today.txt
8 [ -d "$save_at" ] || mkdir "$save_at"
10 url="https://github.com/$owner?tab=repositories"
11 all_repos=$(curl -sL "$url" | grep "name codeRepository" |\
12 awk '{print $2}' | sed "s/href=\"\/$owner\///g" | tr -d '"')
14 echo "<b>repo views clones pullrequests issues</b>" > "$output_file"
16 for each_repo in $all_repos
18 repo_pr=$(git --git-dir "$repos_local_dir"/"$each_repo"/.git pullrequest | wc -l)
19 repo_issues=$(git --git-dir "$repos_local_dir"/"$each_repo"/.git issue | wc -l)
20 views=$(hub api "/repos/$owner/$each_repo/traffic/views" | jq -r '.uniques')
21 clones=$(hub api "/repos/$owner/$each_repo/traffic/clones" | jq -r '.uniques')
22 echo "$each_repo $views $clones $repo_pr $repo_issues" >> "$output_file"
23 echo "$each_repo done"
24 done
26 result=$(column -t "$output_file" | "sort" -k3 -d -r)
27 notify-send "github" "$result"