From 79196b3f24342c5e0b5e51a73562bcd18ee9a6b2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Mar 2026 22:34:14 +0000 Subject: [PATCH] Trigger Dependabot auto-merge on push instead of PR event Using pull_request_target causes the workflow to appear as a skipped check on every non-Dependabot PR. Switching to a push trigger on dependabot/** branches avoids this entirely since push-triggered workflows don't show up as PR checks. https://claude.ai/code/session_012ieS3tLTHwwnh9aftVAPVY --- .github/workflows/dependabot-auto-merge.yml | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index b1f3088ac..8062f9797 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -1,6 +1,10 @@ -# https://docs.github.com/en/code-security/tutorials/secure-your-dependencies/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request +# Auto-merge Dependabot PRs after CI passes. +# Triggers on push to dependabot/* branches so it does NOT appear as a PR check. name: Dependabot auto-merge -on: pull_request_target +on: + push: + branches: + - 'dependabot/**' permissions: contents: write @@ -9,15 +13,13 @@ permissions: jobs: dependabot: runs-on: ubuntu-latest - if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'graphql-java/graphql-java' + if: github.actor == 'dependabot[bot]' && github.repository == 'graphql-java/graphql-java' steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs - run: gh pr merge --auto --squash "$PR_URL" + run: | + PR_URL=$(gh pr list --head "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json url --jq '.[0].url') + if [ -n "$PR_URL" ]; then + gh pr merge --auto --squash "$PR_URL" + fi env: - PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}