#!/usr/bin/env bash #http://redsymbol.net/articles/unofficial-bash-strict-mode/ set -euo pipefail IFS=$'\n\t' CONTRIBFILE=${PWD}/pa_contributors.txt if [ -e ${CONTRIBFILE} ]; then rm ${CONTRIBFILE} fi PA_REPO_DIR=${PWD}/pa/ mkdir -p ${PA_REPO_DIR} pushd ${PA_REPO_DIR} ## Planningalerts repos repo_base="https://github.com/planningalerts-scrapers/" repo_urls=$(for page in 1 2 3; do curl -s https://api.github.com/orgs/planningalerts-scrapers/repos?per_page=100\&page=${page} | jq -r '.[] | .name' done) for repo in ${repo_urls[@]}; do if [ -d ${repo}/.git ]; then pushd ${repo} git pull popd else git clone ${repo_base}${repo}.git fi pushd ${repo} set +e git log --format="%an" --after=2019-07-01 --before=2020-07-01 >> ${CONTRIBFILE} set -e popd done popd echo -n "Total Contributions: " wc -l ${CONTRIBFILE} echo "Contributors:" sort ${CONTRIBFILE} | uniq -c