From a8bfec0fae1605b5193bcce9e3a39246a58b9109 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sun, 22 Nov 2026 07:50:59 -0500 Subject: [PATCH 1/2] Document the permissions every Dependabot auto-merge caller needs Co-Authored-By: Chris Rackauckas Co-Authored-By: Codex Agent-Harness: Codex CLI 0.170.0 Agent-Model: gpt-6.2-astra Agent-Job: 150-codex Agent-Session: local session 01a2034a-f70c-7983-b14b-37c77acf06d6 (no session URL) --- .github/workflows/dependabot-automerge.yml | 8 +++----- README.md | 10 ++++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index 2436862..a65aa6a 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -6,7 +6,7 @@ name: "Reusable Dependabot Auto-merge Workflow" # # Why not a bare `gh pr merge --auto`: native auto-merge only waits on the # checks that branch protection marks *required*, and merges immediately if -# none are required (or if the required set is stale / mis-named). That lets a +# none are required (or if the required set is stale / misnamed). That lets a # red or still-running PR fast-track when a repo's required-status-checks config # is missing or out of date. This workflow instead gates on ALL checks that # actually ran on the head commit, so the gate holds regardless of branch @@ -14,10 +14,8 @@ name: "Reusable Dependabot Auto-merge Workflow" # times out, the PR is left for a human with an explanatory comment (the job # still succeeds — holding is a valid outcome). # -# The caller triggers on pull_request and must grant contents + pull-requests -# write. `checks: read` + `statuses: read` are used to inspect CI; reads work -# without an explicit grant on public repos, but private repos should also -# grant those two scopes on the caller job. +# The pull_request caller must grant contents and pull-requests write access +# plus checks and statuses read access in both public and private repositories. on: workflow_call: diff --git a/README.md b/README.md index 8bace7b..4dee70a 100644 --- a/README.md +++ b/README.md @@ -467,6 +467,12 @@ out, the PR is left for a human with an explanatory comment (the job still succeeds — holding is a valid outcome, not a failure). No repo-level "auto-merge enabled" setting is required. +In both public and private repositories, grant the calling job all four +permissions shown below. GitHub validates the reusable job's permissions before +evaluating its Dependabot actor condition. Omitting either `checks: read` or +`statuses: read` from the caller's permissions causes a startup failure on +every pull request. + | Input | Type | Default | Description | |---|---|---|---| | `update-types` | string | `"version-update:semver-patch,version-update:semver-minor"` | Dependabot update types to auto-merge. | @@ -481,8 +487,8 @@ on: pull_request permissions: contents: write pull-requests: write - checks: read # only needed on private repos - statuses: read # only needed on private repos + checks: read + statuses: read jobs: automerge: uses: "SciML/.github/.github/workflows/dependabot-automerge.yml@v1" From 8a6efbd225c7289584a10965d6307c13caf174f1 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Sun, 22 Nov 2026 16:46:23 -0100 Subject: [PATCH 2/2] Require the four caller grants in the Monorepo Dependabot example A reusable job can never exceed its caller's permissions, and an explicitly enumerated permissions map downgrades every omitted scope to none. The thin-caller guidance in Monorepo.md told maintainers to omit permissions a reusable workflow already declares, and its Dependabot example showed no caller grants, so a caller granting only the two write scopes is rejected before any job is created. Show the complete caller with all four grants, qualify the thin-caller rule, and note in the README that only explicit maps drop the two read scopes. Co-Authored-By: Chris Rackauckas Co-Authored-By: Devin Agent-Harness: Devin CLI 3000.14.30821 Agent-Model: swe-2-high Agent-Job: SciML__.github__151--20261122T174156Z-devin-swe-2-high Agent-Session: local session devin-list:jewel-citrine (no session URL) --- Monorepo.md | 20 ++++++++++++++++++-- README.md | 5 +++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Monorepo.md b/Monorepo.md index 0b05907..c398a78 100644 --- a/Monorepo.md +++ b/Monorepo.md @@ -503,8 +503,12 @@ group from `test_groups.toml` and schedules it on the GPU runner. Every workflow in `.github/workflows/` is a **thin caller** that delegates to a reusable workflow in `SciML/.github` at `@v1`, with `secrets: "inherit"`. Do not inline build/test steps, permissions, or matrices that a reusable workflow -already owns. The target set (the whole fleet, including OrdinaryDiffEq, is being -converted to these thin-caller forms): +already owns. The exception is `permissions:` — a reusable job cannot elevate +its caller's token, and an explicitly enumerated map downgrades every omitted +scope to `none`, so a caller that writes a map must still list every scope the +reusable job requests (see the TagBot and DependabotAutoMerge callers below). +The target set (the whole fleet, including OrdinaryDiffEq, is being converted +to these thin-caller forms): ### `SublibraryCI.yml` → `sublibrary-project-tests.yml@v1` @@ -687,7 +691,19 @@ is unnecessary when there is only one package to scan. See the ### `DependabotAutoMerge.yml` → `dependabot-automerge.yml@v1` +Keep the caller permissions shown below — the same elevation rule as TagBot +applies, and omitting `checks: read` or `statuses: read` rejects the workflow +before any job is created. + ```yaml +# .github/workflows/DependabotAutoMerge.yml +name: Dependabot Auto-merge +on: pull_request +permissions: + contents: write + pull-requests: write + checks: read + statuses: read jobs: automerge: uses: "SciML/.github/.github/workflows/dependabot-automerge.yml@v1" diff --git a/README.md b/README.md index 4dee70a..251dcd8 100644 --- a/README.md +++ b/README.md @@ -470,8 +470,9 @@ enabled" setting is required. In both public and private repositories, grant the calling job all four permissions shown below. GitHub validates the reusable job's permissions before evaluating its Dependabot actor condition. Omitting either `checks: read` or -`statuses: read` from the caller's permissions causes a startup failure on -every pull request. +`statuses: read` from an explicit permissions map causes a startup failure on +every pull request; a caller with no `permissions:` map inherits the +repository's default token scopes instead. | Input | Type | Default | Description | |---|---|---|---|