diff --git a/.zshrc b/.zshrc index 5cdd342..ac8b7b3 100644 --- a/.zshrc +++ b/.zshrc @@ -56,8 +56,6 @@ compdef _git gs=git-status alias gw='git worktree' compdef _git gw=git-worktree -alias gsync='set -x; git checkout main; gh repo sync; git pull; { set +x; } 2>/dev/null' - ## Worktree helpers alias gwa='~/scripts/git-worktree-add.sh' alias gwr='~/scripts/git-worktree-remove.sh' @@ -66,3 +64,10 @@ compdef _git gwr=git-checkout ## GitHub CLI alias gpr='gh pr list' alias gprme='gh pr list --search "review-requested:@me"' + +## Sync fork with upstream +sf() { + local repo=$(git remote get-url origin | sed -E 's#.*github\.com[:/](.+)\.git#\1#') + echo "gh repo sync $repo" + gh repo sync "$repo" +} diff --git a/approve-prs.sh b/approve-prs.sh index 1388c10..0d4b64a 100755 --- a/approve-prs.sh +++ b/approve-prs.sh @@ -111,6 +111,11 @@ while IFS= read -r LINE; do echo if [[ "$CONFIRM" =~ ^[Yy]$ ]]; then + if gh pr merge --auto --merge "$PR_NUMBER" --repo "$REPO"; then + echo "Enabled automerge on PR #$PR_NUMBER" + else + echo "Warning: Failed to enable automerge on PR #$PR_NUMBER" + fi if gh pr review "$PR_NUMBER" --repo "$REPO" --approve; then echo "Approved PR #$PR_NUMBER" else