Skip to content

Instantly share code, notes, and snippets.

@bioform
Created April 8, 2019 10:01
Show Gist options
  • Save bioform/268bc22039a9e3cf23486c09a603818f to your computer and use it in GitHub Desktop.
Save bioform/268bc22039a9e3cf23486c09a603818f to your computer and use it in GitHub Desktop.
#!/bin/bash
TEAM=$1
BRANCH=$2
OWNED_PATTERNS=$(cat ./.github/CODEOWNERS|grep @toptal/$TEAM |cut -d' ' -f1| sed -e 's/^/\.\//')
OWNED_FILES=`git ls-files $OWNED_PATTERNS`
git fetch origin $BRANCH:$BRANCH
CHANGED_FILES=`git diff --name-only $BRANCH $(git merge-base $BRANCH origin/master)`
echo "--------------------------------------------"
for FILE in $CHANGED_FILES; do
if [[ -n `echo "$OWNED_FILES" | grep $FILE` ]]
then
echo $FILE
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment