From 1c5272e6cfc33281b7d7c41a22460a213dcdc8ce Mon Sep 17 00:00:00 2001 From: ItsPaulAT <76869048+ItsPaulAT@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:25:56 +0100 Subject: [PATCH 1/4] 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 | 43 +++++++++++++ .github/workflows/dependabot-automerge.yml | 75 ++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..60fd741 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,43 @@ +# Weekly updates of the action pins and requirements-dev.txt, 7-day cooldown; patch and minor +# updates merge on their own (dependabot-automerge.yml). +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + cooldown: + default-days: 7 + commit-message: + 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: pip + directory: / + schedule: + interval: weekly + day: monday + cooldown: + default-days: 7 + commit-message: + prefix: build + include: scope + labels: [dependencies] + open-pull-requests-limit: 5 + groups: + dev-tools: + patterns: ["*"] + update-types: ["minor", "patch"] + dev-tools-major: + patterns: ["*"] + update-types: ["major"] 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 6c5eed4b386e858a26d33b7d457fce483d7b2f2d Mon Sep 17 00:00:00 2001 From: ItsPaulAT <76869048+ItsPaulAT@users.noreply.github.com> Date: Sat, 21 Nov 2026 08:26:53 +0100 Subject: [PATCH 2/4] ci: drop the up-to-date requirement from the main ruleset Auto-merge then needs no branch update after each merge. Signed-off-by: ItsPaulAT <76869048+ItsPaulAT@users.noreply.github.com> --- rulesets/main.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rulesets/main.json b/rulesets/main.json index d3f689a..4e38278 100644 --- a/rulesets/main.json +++ b/rulesets/main.json @@ -35,7 +35,7 @@ { "type": "required_status_checks", "parameters": { - "strict_required_status_checks_policy": true, + "strict_required_status_checks_policy": false, "do_not_enforce_on_create": false, "required_status_checks": [ { From aa29e6cd10b2579f0801445e1cc84524a6b21f49 Mon Sep 17 00:00:00 2001 From: ItsPaul <76869048+ItsPaulAT@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:32:57 +0100 Subject: [PATCH 3/4] Refine minor version update checks 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..f3b4144 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 dependency version") print("; ".join(reasons) if deps else "no update metadata") PY )" From f78cbfcd3f197a2c17965c2a5e1664e3c09a512e Mon Sep 17 00:00:00 2001 From: ItsPaul <76869048+ItsPaulAT@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:33:43 +0100 Subject: [PATCH 4/4] Enable strict required status checks policy Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: ItsPaul <76869048+ItsPaulAT@users.noreply.github.com> --- rulesets/main.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rulesets/main.json b/rulesets/main.json index 4e38278..d3f689a 100644 --- a/rulesets/main.json +++ b/rulesets/main.json @@ -35,7 +35,7 @@ { "type": "required_status_checks", "parameters": { - "strict_required_status_checks_policy": false, + "strict_required_status_checks_policy": true, "do_not_enforce_on_create": false, "required_status_checks": [ {