Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ 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
# protection config. If any check fails, no checks are present, or the wait
# 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:
Expand Down
20 changes: 18 additions & 2 deletions Monorepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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"
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,13 @@ 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 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 |
|---|---|---|---|
| `update-types` | string | `"version-update:semver-patch,version-update:semver-minor"` | Dependabot update types to auto-merge. |
Expand All @@ -481,8 +488,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"
Expand Down
Loading