Skip to content

Commit 234ec5c

Browse files
committed
additional debugging
1 parent 3ad0d4e commit 234ec5c

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

.github/workflows/auto_merge.yaml

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
types: [opened, synchronize, reopened, ready_for_review]
99
branches: [auto-approve-merge] # Only trigger for PRs targeting this branch
1010
workflow_dispatch: # Add manual trigger for testing
11+
inputs:
12+
pr_number:
13+
description: 'PR number to test auto-merge on'
14+
required: false
15+
type: string
1116

1217
jobs:
1318
debug-context:
@@ -16,14 +21,32 @@ jobs:
1621
steps:
1722
- name: Debug PR Context
1823
run: |
24+
echo "=== WORKFLOW TRIGGER DEBUG ==="
1925
echo "Event Name: ${{ github.event_name }}"
20-
echo "PR Title: ${{ github.event.pull_request.title }}"
26+
echo "Workflow Run ID: ${{ github.run_id }}"
27+
echo "Workflow Run Number: ${{ github.run_number }}"
28+
echo "Repository: ${{ github.repository }}"
29+
echo "Ref: ${{ github.ref }}"
30+
echo "Actor: ${{ github.actor }}"
31+
echo ""
32+
echo "=== PR DETAILS ==="
33+
echo "PR Title: '${{ github.event.pull_request.title }}'"
2134
echo "PR Number: ${{ github.event.pull_request.number }}"
2235
echo "PR State: ${{ github.event.pull_request.state }}"
2336
echo "Is Draft: ${{ github.event.pull_request.draft }}"
2437
echo "Base Branch: ${{ github.event.pull_request.base.ref }}"
2538
echo "Head Branch: ${{ github.event.pull_request.head.ref }}"
26-
echo "Contains check: ${{ contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
39+
echo "PR Author: ${{ github.event.pull_request.user.login }}"
40+
echo "PR Author Type: ${{ github.event.pull_request.user.type }}"
41+
echo ""
42+
echo "=== CONDITION CHECKS ==="
43+
echo "Title contains 'Auto-merge workflow': ${{ contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
44+
echo "Title contains 'Test:': ${{ contains(github.event.pull_request.title, 'Test:') }}"
45+
echo "Author is github-actions: ${{ github.event.pull_request.user.login == 'app/github-actions' }}"
46+
echo ""
47+
echo "=== TOKEN DEBUG ==="
48+
echo "AUTO_MERGE_TOKEN exists: ${{ secrets.AUTO_MERGE_TOKEN != '' }}"
49+
echo "GITHUB_TOKEN exists: ${{ secrets.GITHUB_TOKEN != '' }}"
2750
2851
auto-approve-merge:
2952
runs-on: ubuntu-latest
@@ -35,6 +58,7 @@ jobs:
3558
run: |
3659
echo "🔍 Checking if should auto-merge..."
3760
echo "PR Title: '${{ github.event.pull_request.title }}'"
61+
echo "Condition result: ${{ contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
3862
3963
if [[ "${{ github.event.pull_request.title }}" == *"Auto-merge workflow"* ]]; then
4064
echo "✅ Title contains 'Auto-merge workflow' - proceeding"
@@ -43,15 +67,35 @@ jobs:
4367
exit 0 # Don't fail, just skip
4468
fi
4569
70+
- name: Check PR status
71+
run: |
72+
echo "=== PR STATUS CHECK ==="
73+
gh pr view ${{ github.event.pull_request.number }} --json state,mergeable,mergeStateStatus,reviewDecision
74+
echo ""
75+
echo "=== PR REVIEWS ==="
76+
gh pr view ${{ github.event.pull_request.number }} --json reviews
77+
echo ""
78+
echo "=== PR CHECKS ==="
79+
gh pr checks ${{ github.event.pull_request.number }}
80+
env:
81+
GH_TOKEN: ${{ secrets.AUTO_MERGE_TOKEN }}
82+
4683
- name: Auto approve and merge
4784
if: contains(github.event.pull_request.title, 'Auto-merge workflow')
4885
run: |
49-
echo "Auto-merging PR #${{ github.event.pull_request.number }}"
86+
echo "=== STARTING AUTO-MERGE PROCESS ==="
87+
echo "PR Number: ${{ github.event.pull_request.number }}"
88+
echo "Token available: ${{ secrets.AUTO_MERGE_TOKEN != '' }}"
5089
51-
# Approve
52-
gh pr review ${{ github.event.pull_request.number }} --approve
90+
echo "Step 1: Approving PR..."
91+
gh pr review ${{ github.event.pull_request.number }} --approve --body "Auto-approved by workflow"
92+
echo "✅ Approval completed"
5393
54-
# Enable auto-merge
94+
echo "Step 2: Enabling auto-merge..."
5595
gh pr merge ${{ github.event.pull_request.number }} --auto --merge --delete-branch
96+
echo "✅ Auto-merge enabled"
97+
98+
echo "Step 3: Final PR status..."
99+
gh pr view ${{ github.event.pull_request.number }} --json state,mergeable,mergeStateStatus
56100
env:
57101
GH_TOKEN: ${{ secrets.AUTO_MERGE_TOKEN }}

0 commit comments

Comments
 (0)