Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Last active March 24, 2023 19:17
Show Gist options
  • Select an option

  • Save KyMidd/fbac58b4ae3c6185c04f130e035affbb to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/fbac58b4ae3c6185c04f130e035affbb to your computer and use it in GitHub Desktop.
# If there are no changes, the PR will not be created
# Note that even modified files will show up as 'add' in the git add output
if [[ $(echo "$git_add" | grep -E 'add|remove') ]]; then
# Changes were made, checkout a branch and make a PR
git checkout -b "$branch_name"
git commit -m "$commit_message"
git push origin "$branch_name"
created_pr_url=$(gh pr create -b "$pr_body" -t "$pr_title" -B "$base_branch" --fill)
# If auto_merge_pr is true, merge the PR
if [ "$auto_merge_pr" = true ]; then
gh pr merge --admin -d -m "$created_pr_url"
else
echo "PR created, please merge: $created_pr_url"
fi
# Sleep 2 seconds to avoid rate limiting
sleep 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment