@@ -65,17 +65,34 @@ jobs:
65
65
66
66
auto-merge :
67
67
needs : resolve-conflicts
68
- if : github.event.pull_request.user.login == 'dependabot[bot]'
69
68
runs-on : ubuntu-latest
70
69
71
70
steps :
72
- - name : Fetch Dependabot metadata
73
- id : metadata
74
- uses : dependabot/fetch-metadata@v1
71
+ - name : Mark auto-merge check for non-Dependabot PRs
72
+ if : github.event.pull_request.user.login != 'dependabot[bot]'
73
+ run : |
74
+ echo "Skipping dependabot-auto-merge for non-Dependabot PRs."
75
+ exit 0 # This prevents it from failing on non-Dependabot PRs
76
+
77
+ - name : Checkout PR branch
78
+ if : github.event.pull_request.user.login == 'dependabot[bot]'
79
+ uses : actions/checkout@v4
75
80
with :
76
- github-token : " ${{ secrets.GITHUB_TOKEN }}"
81
+ ref : ${{ github.event.pull_request.head.ref }}
82
+ fetch-depth : 0
83
+
84
+ - name : Pull latest changes from PR branch
85
+ if : github.event.pull_request.user.login == 'dependabot[bot]'
86
+ run : |
87
+ git config --global user.name "github-actions[bot]"
88
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
89
+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
90
+ git fetch origin ${{ github.event.pull_request.head.ref }}
91
+ git rebase origin/${{ github.event.pull_request.head.ref }} || git rebase --abort
92
+ git push origin HEAD --force-with-lease
77
93
78
94
- name : Enable auto-merge for Dependabot PRs
95
+ if : github.event.pull_request.user.login == 'dependabot[bot]'
79
96
run : gh pr merge --auto --merge "$PR_URL"
80
97
env :
81
98
PR_URL : ${{ github.event.pull_request.html_url }}
0 commit comments