Skip to content

Instantly share code, notes, and snippets.

@karancode
Last active May 1, 2020 06:13
Show Gist options
  • Select an option

  • Save karancode/17597b3212ab13805690c25f9f37c9a6 to your computer and use it in GitHub Desktop.

Select an option

Save karancode/17597b3212ab13805690c25f9f37c9a6 to your computer and use it in GitHub Desktop.
To create PRs in multiple repositories for similar code.
#!/bin/bash
git_owner="karancode"
git_repo=${1}
if [ -d "${git_repo}" ]; then
cd ${git_repo}
git checkout .
git checkout master
else
git clone https://github.com/${git_owner}/${git_repo}.git
cd ${git_repo}
fi
git pull --all
git rev-parse --verify githubaction
exit_code=${?}
if [ "${exit_code}" != "0" ]; then
git checkout -b githubaction
else
git checkout githubaction
fi
mkdir -p .github/workflows
cp /Users/karan.thanvi/Desktop/githubactions/base.yaml .github/workflows/
cp /Users/karan.thanvi/Desktop/githubactions/dev.yaml .github/workflows/
cp /Users/karan.thanvi/Desktop/githubactions/stg.yaml .github/workflows/
git add .github/workflows/
git commit -m "github action for dev/stg"
git push --set-upstream origin githubaction
hub pull-request --message "github action for base/dev/stg" -r ttamari,m3y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment