From f8474fade3c0ce094c8a4553c9898482c29b6a24 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Wed, 15 Jul 2026 02:26:20 -0400 Subject: [PATCH] feat(selector): route same-repository Dependabot runs to the fleet Dependabot-triggered CI was a reviewed hosted exception; the org owner approved retiring it so dependency-bump lanes run in ephemeral one-job workers instead of drawing the hosted included-minute reserve. Fork and public guards are untouched, the observer key stays confined to the selector job, and Dependabot events source it from the Dependabot secrets store, which the org now mirrors. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01JLfjHY8PY6ozhgZPiuHKik --- .github/scripts/select-runner.cjs | 16 +++++++--------- .github/scripts/select-runner.test.cjs | 6 ------ .github/workflows/select-runner.yml | 22 ++++++++-------------- README.md | 13 ++++++++----- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/.github/scripts/select-runner.cjs b/.github/scripts/select-runner.cjs index fa82dc54..beff165a 100644 --- a/.github/scripts/select-runner.cjs +++ b/.github/scripts/select-runner.cjs @@ -168,14 +168,13 @@ function preflight(input) { const selfHostedOnly = input.policy === "self-hosted-only"; // Public repositories do not save billed minutes. Only explicitly reviewed - // caller event classes may route locally, and fork/Dependabot code must never - // receive the observer credential. This guard is duplicated on the token- - // minting step so these cases are rejected before that action runs. - if ( - input.repositoryPrivate !== true || - !permitsLocalExecution(input) || - input.isDependabot - ) { + // caller event classes may route locally, and fork code must never receive + // the observer credential. This guard is duplicated on the token-minting + // step so these cases are rejected before that action runs. Same-repository + // Dependabot branches are a reviewed local class: their lane code runs in + // ephemeral one-job workers, and the observer key stays inside the selector + // job, sourced from the Dependabot secrets store on Dependabot events. + if (input.repositoryPrivate !== true || !permitsLocalExecution(input)) { return { result: hostedResult(hostedRunner, "hosted-only") }; } @@ -548,7 +547,6 @@ function inputsFromEnvironment(env) { repositoryPrivate: env.REPOSITORY_PRIVATE === "true", eventName: env.EVENT_NAME, isForkPullRequest: env.IS_FORK_PULL_REQUEST === "true", - isDependabot: env.IS_DEPENDABOT === "true", }; } diff --git a/.github/scripts/select-runner.test.cjs b/.github/scripts/select-runner.test.cjs index f1e05e7f..e415a335 100644 --- a/.github/scripts/select-runner.test.cjs +++ b/.github/scripts/select-runner.test.cjs @@ -52,7 +52,6 @@ function input(overrides = {}) { repositoryPrivate: true, eventName: "push", isForkPullRequest: false, - isDependabot: false, ...overrides, }; } @@ -151,7 +150,6 @@ for (const [name, overrides, reason] of [ for (const [name, overrides] of [ ["public repository", { repositoryPrivate: false }], ["fork pull request", { eventName: "pull_request", isForkPullRequest: true }], - ["Dependabot", { isDependabot: true }], ["blocked event", { eventName: "pull_request_target" }], ]) { test(`self-hosted-only keeps ${name} on the hosted security route`, async () => { @@ -221,7 +219,6 @@ for (const [routeName, overrides, reason] of [ for (const [name, overrides] of [ ["public repository", { repositoryPrivate: false }], ["fork pull request", { eventName: "pull_request", isForkPullRequest: true }], - ["Dependabot", { isDependabot: true }], ]) { test(`${name} routes hosted before authentication or inventory`, async () => { const result = await selectRunner( @@ -938,8 +935,6 @@ test("token mint is statically guarded before the App action runs", () => { "github.event_name == 'workflow_dispatch'", "github.event_name == 'pull_request'", "github.event.repository.private == true", - "github.actor != 'dependabot[bot]'", - "github.secret_source != 'Dependabot'", "github.event.pull_request.head.repo.full_name == github.repository", ]) { assert.ok(tokenStep.includes(requiredGuard), requiredGuard); @@ -1060,7 +1055,6 @@ test("generated github-script bundle executes the tested adapter", async () => { REPOSITORY_PRIVATE: "true", EVENT_NAME: "push", IS_FORK_PULL_REQUEST: "false", - IS_DEPENDABOT: "false", API_TIMEOUT_SECONDS: "10", }, }, diff --git a/.github/workflows/select-runner.yml b/.github/workflows/select-runner.yml index 026836b7..0ebee1ff 100644 --- a/.github/workflows/select-runner.yml +++ b/.github/workflows/select-runner.yml @@ -96,9 +96,7 @@ jobs: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && env.HAS_OBSERVER_SECRET == 'true' && - github.event.repository.private == true && - github.actor != 'dependabot[bot]' && - github.secret_source != 'Dependabot' + github.event.repository.private == true continue-on-error: true uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 with: @@ -130,8 +128,6 @@ jobs: IS_FORK_PULL_REQUEST: >- ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} - IS_DEPENDABOT: >- - ${{ github.actor == 'dependabot[bot]' || github.secret_source == 'Dependabot' }} API_TIMEOUT_SECONDS: ${{ inputs.api-timeout-seconds }} with: github-token: ${{ steps.observer-token.outputs.token || github.token }} @@ -310,14 +306,13 @@ jobs: const selfHostedOnly = input.policy === "self-hosted-only"; // Public repositories do not save billed minutes. Only explicitly reviewed - // caller event classes may route locally, and fork/Dependabot code must never - // receive the observer credential. This guard is duplicated on the token- - // minting step so these cases are rejected before that action runs. - if ( - input.repositoryPrivate !== true || - !permitsLocalExecution(input) || - input.isDependabot - ) { + // caller event classes may route locally, and fork code must never receive + // the observer credential. This guard is duplicated on the token-minting + // step so these cases are rejected before that action runs. Same-repository + // Dependabot branches are a reviewed local class: their lane code runs in + // ephemeral one-job workers, and the observer key stays inside the selector + // job, sourced from the Dependabot secrets store on Dependabot events. + if (input.repositoryPrivate !== true || !permitsLocalExecution(input)) { return { result: hostedResult(hostedRunner, "hosted-only") }; } @@ -690,7 +685,6 @@ jobs: repositoryPrivate: env.REPOSITORY_PRIVATE === "true", eventName: env.EVENT_NAME, isForkPullRequest: env.IS_FORK_PULL_REQUEST === "true", - isDependabot: env.IS_DEPENDABOT === "true", }; } diff --git a/README.md b/README.md index 74546a9e..a0f25d67 100644 --- a/README.md +++ b/README.md @@ -174,10 +174,13 @@ GitHub continues the normal weekly patching of each hosted image generation. immutable selector revision. Invalid queue-only configuration and selector infrastructure faults fail the selector job instead of falling back to paid hosted execution. Public - repositories, fork pull requests, and Dependabot runs route hosted before the - observer-token action can execute, following GitHub's - [self-hosted runner security guidance][runner-security] and - [Dependabot secret boundary][dependabot-secrets]. Call it exactly once per + repositories and fork pull requests route hosted before the observer-token + action can execute, following GitHub's + [self-hosted runner security guidance][runner-security]. Same-repository + Dependabot runs route like any push: their lane code executes in ephemeral + one-job workers, and the selector sources the observer key from the + [Dependabot secrets store][dependabot-secrets] on Dependabot events, so the + org mirrors `CI_RUNNER_OBSERVER_PRIVATE_KEY` there. Call it exactly once per workflow and feed the single output to every lane's `runs-on`; per-lane selector fan-out only multiplies identical preflight jobs: @@ -481,7 +484,7 @@ GitHub continues the normal weekly patching of each hosted image generation. directory with a per-job cache and without Docker, a job/service container, or an installer-time privilege escalation. `runner` defaults to `ubuntu-24.04` and can consume the approved selector output for eligible - private, non-fork, non-Dependabot calls. SARIF upload and blocking promotion + private, non-fork calls. SARIF upload and blocking promotion remain deferred opt-ins. Inputs are documented inline. - `.github/workflows/osv-scanner.yml` — dependency vulnerability scan with Google's official native OSV-Scanner v2.4.0 Linux X64 binary. The exact binary,