3535# bumps for dependabot/fetch-metadata flow through the same path.
3636
3737name : Dependabot Auto-Merge
38-
3938on :
4039 pull_request :
4140 types : [opened, reopened, synchronize]
42-
4341permissions :
44- contents : write # needed to enable auto-merge
45- pull-requests : write # needed to approve
42+ contents : write # needed to enable auto-merge
43+ pull-requests : write # needed to approve
4644 # NB: keep narrow — do NOT add secrets: read or id-token: write here.
47-
4845jobs :
4946 automerge :
5047 # Only run for PRs actually authored by Dependabot.
5148 if : github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]'
5249 runs-on : ubuntu-latest
5350 timeout-minutes : 15
54-
5551 steps :
5652 - name : Fetch Dependabot metadata
5753 id : meta
5854 uses : dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
5955 with :
6056 github-token : ${{ secrets.GITHUB_TOKEN }}
61-
6257 # --- Policy gate -------------------------------------------------------
6358 # Outputs from fetch-metadata we care about:
6459 # update-type → version-update:semver-{patch,minor,major}
@@ -107,7 +102,6 @@ jobs:
107102 echo "security=$is_security" >> "$GITHUB_OUTPUT"
108103 echo "update_type=$UPDATE_TYPE" >> "$GITHUB_OUTPUT"
109104 echo "ghsa=$GHSA_ID" >> "$GITHUB_OUTPUT"
110-
111105 - name : Approve PR (if policy allows)
112106 if : steps.policy.outputs.action == 'automerge'
113107 env :
@@ -116,15 +110,13 @@ jobs:
116110 run : |
117111 gh pr review --approve "$PR_URL" \
118112 --body "Auto-approving Dependabot security update (${{ steps.policy.outputs.ghsa }}, ${{ steps.policy.outputs.update_type }}). Policy: low/moderate security patches/minors only."
119-
120113 - name : Enable auto-merge (if policy allows)
121114 if : steps.policy.outputs.action == 'automerge'
122115 env :
123116 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
124117 PR_URL : ${{ github.event.pull_request.html_url }}
125118 run : |
126119 gh pr merge --auto --squash "$PR_URL"
127-
128120 - name : Write decision to step summary
129121 env :
130122 ACTION : ${{ steps.policy.outputs.action }}
0 commit comments