diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 2630cb21..e661031f 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -15,11 +15,39 @@ jobs: app-id: ${{ vars.APP_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} + # Structured info about the update (crate names, group, semver bump). + # `dependency-names` lists every crate the PR touches — including for + # grouped PRs whose titles ("bump the oxc group") don't name the crates. + - name: Fetch Dependabot metadata + id: meta + uses: dependabot/fetch-metadata@v3 + - name: Approve and enable auto-merge run: | + set -euo pipefail gh pr review "$PR_NUMBER" --repo "$REPO" --approve --body "Dependabot PR — auto-approved." - gh pr merge "$PR_NUMBER" --repo "$REPO" --auto --squash + + # Parser/grammar dependency bumps are relabeled from the hidden + # `build(deps)` type to the custom `deps:` type, which + # release-please surfaces under "Parser & Grammar Updates" (see + # release-please-config.json). Every other dependency bump keeps + # `build(deps)` and stays out of the changelog. release-please + # matches on commit TYPE only (it has no scope filter), so the + # discrimination must be baked into the squashed subject here. + # + # We match on crate-name prefix rather than the PR title so grouped + # PRs are classified correctly. release-please links a changelog + # entry via the trailing "(#NN)", and a custom --subject replaces + # GitHub's default subject entirely, so we re-add it by hand. + if printf '%s' "$NAMES" | grep -qiE '(^|,)[[:space:]]*(tree-sitter|oxc_|mago-|ruff_|sqruff-|pulldown-cmark|ra_ap_|antlr-rust-runtime)'; then + gh pr merge "$PR_NUMBER" --repo "$REPO" --auto --squash \ + --subject "deps: ${TITLE#*: } (#${PR_NUMBER})" + else + gh pr merge "$PR_NUMBER" --repo "$REPO" --auto --squash + fi env: GH_TOKEN: ${{ steps.app-token.outputs.token }} PR_NUMBER: ${{ github.event.pull_request.number }} REPO: ${{ github.repository }} + NAMES: ${{ steps.meta.outputs.dependency-names }} + TITLE: ${{ github.event.pull_request.title }} diff --git a/release-please-config.json b/release-please-config.json index c3d85395..08023d55 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -10,13 +10,7 @@ "prerelease": false, "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": false, - "changelog-types": [ - { - "type": "chore", - "scope": "deps", - "section": "Dependencies", - "hidden": false - }, + "changelog-sections": [ { "type": "feat", "section": "Features", @@ -33,43 +27,13 @@ "hidden": false }, { - "type": "revert", - "section": "Reverts", + "type": "deps", + "section": "Parser & Grammar Updates", "hidden": false }, { - "type": "docs", - "section": "Documentation", - "hidden": false - }, - { - "type": "style", - "section": "Styles", - "hidden": false - }, - { - "type": "chore", - "section": "Miscellaneous", - "hidden": false - }, - { - "type": "refactor", - "section": "Code Refactoring", - "hidden": false - }, - { - "type": "test", - "section": "Tests", - "hidden": false - }, - { - "type": "build", - "section": "Build System", - "hidden": false - }, - { - "type": "ci", - "section": "Continuous Integration", + "type": "revert", + "section": "Reverts", "hidden": false } ],