A concrete example how I automated a chore update of multiple repostitories that I do not own => to create pull requests (PRs) with the same simple change in each repo.
- Install https://cli.github.com/ and
gh auth login
mkdir testingjavascript && cd $_
- Navigate to a GitHub topic like https://github.com/topics/testingjavascript (or epicreact-dev, ...) to get a list of repo links, e.g. execute following in browser console:
copy([
...new Set($$('h1 > a[href^="/kentcdodds/"]').map(el => `gh repo fork ${el.href}.git --clone --remote`))
].join('; '))
- paste the shell command, review, and execute in the new directory
- review that you have correct repos
- display your browser and bash terminal side by side
- make the small change in each directory and open new PRs in browser tabs (to review each before submitting)
ls -d */ | xargs -I {} bash -c "cd '{}' \
&& echo '.eslintcache' >> .gitignore \
&& git add . \
&& git commit -m 'chore: ignore .eslintcache' \
&& git push \
&& gh pr create --web"
Note: the double >>
is important if you want to only modify the last line of file and not modify whole file with single >
. Of course, you also need to modify your commit message to match your change 😉
FTR this was a workaround for facebook/create-react-app#10161