forked from SoroLabs/SoroTask
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge_remaining_prs.sh
More file actions
executable file
·52 lines (42 loc) · 1.46 KB
/
Copy pathmerge_remaining_prs.sh
File metadata and controls
executable file
·52 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Script to reopen and merge closed PRs
PR_LIST="52 61 62 63 64 70 71 72 73 74 75 76 78 79 151 283 340 341 342 343"
echo "Found $(echo "$PR_LIST" | wc -w) PRs to merge"
echo "Starting merge process..."
MERGE_COUNT=0
ERROR_COUNT=0
for PR_NUMBER in $PR_LIST; do
echo ""
echo "========================================="
echo "Processing PR #$PR_NUMBER"
echo "========================================="
# Check if PR is closed
STATE=$(gh pr view $PR_NUMBER --json state --jq '.state')
echo "Current state: $STATE"
# If closed, reopen it first
if [ "$STATE" = "CLOSED" ]; then
echo "Reopening PR #$PR_NUMBER..."
gh pr reopen $PR_NUMBER
sleep 1
fi
# Try to merge the PR
if git merge origin/pr/$PR_NUMBER --strategy-option=ours --no-edit 2>&1; then
echo "✓ Successfully merged PR #$PR_NUMBER"
MERGE_COUNT=$((MERGE_COUNT + 1))
else
echo "✗ Failed to merge PR #$PR_NUMBER"
ERROR_COUNT=$((ERROR_COUNT + 1))
# Abort any failed merge
git merge --abort 2>/dev/null || true
fi
# Small delay
sleep 0.5
done
echo ""
echo "========================================="
echo "Merge Summary"
echo "========================================="
echo "✓ Successfully merged: $MERGE_COUNT PRs"
echo "✗ Failed: $ERROR_COUNT PRs"
echo "Total processed: $((MERGE_COUNT + ERROR_COUNT)) PRs"
echo "========================================="