From d9220349d544b115a6077ff84407daf7098db81d Mon Sep 17 00:00:00 2001 From: ItsPaulAT <76869048+ItsPaulAT@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:25:31 +0100 Subject: [PATCH 1/2] ci: let Dependabot merge patch and minor updates Weekly grouped updates with majors in their own group. Patch and minor updates are approved and set to auto-merge (squash); majors stay manual. Signed-off-by: ItsPaulAT <76869048+ItsPaulAT@users.noreply.github.com> --- .github/dependabot.yml | 10 +++ .github/workflows/dependabot-automerge.yml | 75 ++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7bdae66..96b1889 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -19,9 +19,14 @@ updates: prefix: ci include: scope labels: [dependencies] + open-pull-requests-limit: 5 groups: actions: patterns: ["*"] + update-types: ["minor", "patch"] + actions-major: + patterns: ["*"] + update-types: ["major"] - package-ecosystem: npm directory: / @@ -34,9 +39,14 @@ updates: prefix: build include: scope labels: [dependencies] + open-pull-requests-limit: 5 groups: npm: patterns: ["*"] + update-types: ["minor", "patch"] + npm-major: + patterns: ["*"] + update-types: ["major"] ignore: # Expo SDK packages move together ("npx expo install --fix"); majors are bumped by hand. - dependency-name: "expo" diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml new file mode 100644 index 0000000..6410110 --- /dev/null +++ b/.github/workflows/dependabot-automerge.yml @@ -0,0 +1,75 @@ +# Approves Dependabot's patch and minor updates and turns on auto-merge (squash); GitHub merges +# once the required checks pass. Majors, 0.x minors and updates without a semver type (image +# digests) stay for a manual review. The update types come from the metadata block of +# Dependabot's commit message, the same source dependabot/fetch-metadata reads. +name: dependabot-automerge + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: {} + +concurrency: + group: dependabot-automerge-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + automerge: + name: automerge + if: >- + github.event.pull_request.user.login == 'dependabot[bot]' && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: write + pull-requests: write + steps: + - name: Approve and enable auto-merge for patch and minor updates + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + set -euo pipefail + commits="$(gh api "repos/$REPO/pulls/$PR_NUMBER/commits?per_page=100")" + authors="$(jq -r '[.[].author.login // "unknown"] | unique | join(",")' <<<"$commits")" + if [ "$authors" != "dependabot[bot]" ]; then + echo "::notice::Commits by $authors; left for a manual review." + exit 0 + fi + export MESSAGE + MESSAGE="$(jq -r '.[-1].commit.message' <<<"$commits")" + verdict="$(python3 - <<'PY' + import os + deps, block = [], False + for line in os.environ["MESSAGE"].splitlines(): + if line == "updated-dependencies:": + block = True + elif block and line in ("...", "---", ""): + break + elif block and line.startswith("- "): + deps.append({}) + if block and deps and ":" in line: + key, _, value = line[2:].partition(":") + deps[-1][key.strip()] = value.strip().strip("'\"") + reasons = [] + for d in deps: + kind = d.get("update-type", "") + name = d.get("dependency-name", "?") + if kind not in ("version-update:semver-patch", "version-update:semver-minor"): + reasons.append(f"{name}: {kind or 'no semver update type'}") + elif kind.endswith("minor") and d.get("dependency-version", "").startswith("0."): + reasons.append(f"{name}: minor update below 1.0") + print("; ".join(reasons) if deps else "no update metadata") + PY + )" + if [ -n "$verdict" ]; then + echo "::notice::Left for a manual review ($verdict)." + exit 0 + fi + url="https://github.com/$REPO/pull/$PR_NUMBER" + gh pr review "$url" --approve || echo "::warning::Could not approve the pull request." + gh pr merge "$url" --auto --squash --match-head-commit "$HEAD_SHA" From 4d1caee63df3e77805369048d12ada6db612f6cf Mon Sep 17 00:00:00 2001 From: ItsPaul <76869048+ItsPaulAT@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:35:17 +0100 Subject: [PATCH 2/2] Refine minor update version check for dependencies Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: ItsPaul <76869048+ItsPaulAT@users.noreply.github.com> --- .github/workflows/dependabot-automerge.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index 6410110..833b0df 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -61,8 +61,11 @@ jobs: name = d.get("dependency-name", "?") if kind not in ("version-update:semver-patch", "version-update:semver-minor"): reasons.append(f"{name}: {kind or 'no semver update type'}") - elif kind.endswith("minor") and d.get("dependency-version", "").startswith("0."): - reasons.append(f"{name}: minor update below 1.0") + elif kind.endswith("minor") and ( + not d.get("dependency-version") + or d["dependency-version"].startswith("0.") + ): + reasons.append(f"{name}: minor update below 1.0 or unknown version") print("; ".join(reasons) if deps else "no update metadata") PY )"