Fix dependabot auto-merge workflow: branch protection + Node 20 deprecation - #152
Conversation
…and add --auto flag with error handling
| github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
| - name: Merge Dependabot PRs | ||
| run: gh pr merge --rebase "$PR_URL" | ||
| run: gh pr merge --auto --rebase "$PR_URL" || true |
There was a problem hiding this comment.
@copilot Are you sure about this? Will this merge the pr if the first command fails?
There was a problem hiding this comment.
Good question. The || true does not merge the PR if the --auto command fails — it only prevents the workflow from reporting a failure exit code.
The design here is:
--autois needed because branch protection rules block an immediate merge;--autoqueues the merge to happen once all checks pass- If the repository doesn't have auto-merge enabled at the settings level,
gh pr merge --autowill fail with an error —|| truemakes that a silent no-op rather than a red workflow run
If the first command fails (e.g. auto-merge not enabled), the PR simply won't be merged automatically, but the workflow won't show as broken. If you'd rather have the workflow fail loudly in that case, I can remove the || true.
There was a problem hiding this comment.
@copilot what about trying a direct merge as well as the auto merge?
There was a problem hiding this comment.
Done in bf25cbe. The command is now gh pr merge --auto --rebase "$PR_URL" || gh pr merge --rebase "$PR_URL" — it tries auto-merge first, and falls back to a direct merge if auto-merge isn't available.
f664713
into
dependabot/nuget/JWLMerge.BackupFileServices/Microsoft.Data.Sqlite-10.0.10
gh pr merge --rebasewas failing immediately when branch protection rules required status checks to pass. Additionally,dependabot/fetch-metadata@v2.3.0was triggering Node.js 20 deprecation warnings on current runners.Changes
dependabot/fetch-metadatav2.3.0 → v3.1.0 — natively targets Node.js 24, eliminating the deprecation warning--autoflag ongh pr merge— queues the merge until branch protection requirements are satisfied instead of failing outright|| true— prevents workflow failure when auto-merge is not enabled at the repository level