Skip to content

Commit b4972e3

Browse files
authored
Merge pull request #4304 from graphql-java/claude/dependabot-auto-merge-config-ekRMj
Fix Dependabot auto-merge showing as skipped check on all PRs
2 parents 692f30d + 79196b3 commit b4972e3

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# https://docs.github.com/en/code-security/tutorials/secure-your-dependencies/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
1+
# Auto-merge Dependabot PRs after CI passes.
2+
# Triggers on push to dependabot/* branches so it does NOT appear as a PR check.
23
name: Dependabot auto-merge
3-
on: pull_request_target
4+
on:
5+
push:
6+
branches:
7+
- 'dependabot/**'
48

59
permissions:
610
contents: write
@@ -9,15 +13,13 @@ permissions:
913
jobs:
1014
dependabot:
1115
runs-on: ubuntu-latest
12-
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'graphql-java/graphql-java'
16+
if: github.actor == 'dependabot[bot]' && github.repository == 'graphql-java/graphql-java'
1317
steps:
14-
- name: Dependabot metadata
15-
id: metadata
16-
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
17-
with:
18-
github-token: "${{ secrets.GITHUB_TOKEN }}"
1918
- name: Enable auto-merge for Dependabot PRs
20-
run: gh pr merge --auto --squash "$PR_URL"
19+
run: |
20+
PR_URL=$(gh pr list --head "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json url --jq '.[0].url')
21+
if [ -n "$PR_URL" ]; then
22+
gh pr merge --auto --squash "$PR_URL"
23+
fi
2124
env:
22-
PR_URL: ${{ github.event.pull_request.html_url }}
2325
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)