Skip to content

Instantly share code, notes, and snippets.

@bboughton
Last active June 25, 2020 21:13
Show Gist options
  • Save bboughton/6b4b42d3db498188c003f8fda4d497aa to your computer and use it in GitHub Desktop.
Save bboughton/6b4b42d3db498188c003f8fda4d497aa to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Example of mass adding CODEOWNERS
cd $(mktemp -d)
set -e
cat ~/Desktop/repos.txt | while read repo; do \
git clone git@github.com:infusionsoft/${repo}.git || echo "repo already cloned"
pushd ${repo}
if [[ -f CODEOWNERS ]]; then
echo "CODEOWNERS file already exists"
popd
continue
fi
echo '* @infusionsoft/your-team-name' > CODEOWNERS
git add CODEOWNERS
git commit -m 'Adding CODEOWNERS'
git push origin master || {
git push origin master:add-codeowners
open "https://github.com/infusionsoft/${repo}/pull/new/add-codeowners"
}
popd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment