@@ -41,29 +41,36 @@ jobs:
4141 echo ""
4242 echo "=== CONDITION CHECKS ==="
4343 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:') }}"
4544 echo "Author is github-actions: ${{ github.event.pull_request.user.login == 'app/github-actions' }}"
45+ echo "Both conditions met: ${{ github.event.pull_request.user.login == 'app/github-actions' && contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
4646 echo ""
4747 echo "=== TOKEN DEBUG ==="
4848 echo "AUTO_MERGE_TOKEN exists: ${{ secrets.AUTO_MERGE_TOKEN != '' }}"
4949 echo "GITHUB_TOKEN exists: ${{ secrets.GITHUB_TOKEN != '' }}"
5050
5151 auto-approve-merge :
5252 runs-on : ubuntu-latest
53- # TODO: restore condition
54- if : contains(github.event.pull_request.title, 'Auto-merge workflow')
53+ # Only auto-merge PRs created by github-actions[bot] with the test title
54+ if : |
55+ github.event.pull_request.user.login == 'app/github-actions' &&
56+ contains(github.event.pull_request.title, 'Auto-merge workflow')
5557
5658 steps :
5759 - name : Check conditions
5860 run : |
5961 echo "🔍 Checking if should auto-merge..."
6062 echo "PR Title: '${{ github.event.pull_request.title }}'"
61- echo "Condition result: ${{ contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
63+ echo "PR Author: '${{ github.event.pull_request.user.login }}'"
64+ echo "Title condition: ${{ contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
65+ echo "Author condition: ${{ github.event.pull_request.user.login == 'app/github-actions' }}"
66+ echo "Both conditions: ${{ github.event.pull_request.user.login == 'app/github-actions' && contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
6267
63- if [[ "${{ github.event.pull_request.title }}" == *"Auto-merge workflow"* ]]; then
64- echo "✅ Title contains 'Auto-merge workflow' - proceeding"
68+ if [[ "${{ github.event.pull_request.user.login }}" == "app/github-actions" && "${{ github.event.pull_request. title }}" == *"Auto-merge workflow"* ]]; then
69+ echo "✅ Both conditions met - proceeding with auto-merge "
6570 else
66- echo "❌ Title does not contain 'Auto-merge workflow' - would skip"
71+ echo "❌ Conditions not met - would skip"
72+ echo " - Author is github-actions: ${{ github.event.pull_request.user.login == 'app/github-actions' }}"
73+ echo " - Title contains 'Auto-merge workflow': ${{ contains(github.event.pull_request.title, 'Auto-merge workflow') }}"
6774 exit 0 # Don't fail, just skip
6875 fi
6976
8188 GH_TOKEN : ${{ secrets.AUTO_MERGE_TOKEN }}
8289
8390 - name : Auto approve and merge
84- if : contains(github.event.pull_request.title, 'Auto-merge workflow')
91+ if : |
92+ github.event.pull_request.user.login == 'app/github-actions' &&
93+ contains(github.event.pull_request.title, 'Auto-merge workflow')
8594 run : |
8695 echo "=== STARTING AUTO-MERGE PROCESS ==="
8796 echo "PR Number: ${{ github.event.pull_request.number }}"
0 commit comments