Skip to content

ci: fall back to ubuntu-latest for fork PRs#49

Merged
27Bslash6 merged 2 commits into
mainfrom
ci/fork-pr-runner-strategy
May 17, 2026
Merged

ci: fall back to ubuntu-latest for fork PRs#49
27Bslash6 merged 2 commits into
mainfrom
ci/fork-pr-runner-strategy

Conversation

@27Bslash6
Copy link
Copy Markdown
Contributor

@27Bslash6 27Bslash6 commented May 17, 2026

Summary

GitHub Actions disables self-hosted runners for fork PRs by security policy. With every CI job currently pinned to cachekit-lean / cachekit, an external contributor's PR would sit in waiting for runner forever — silent friction that kills OSS adoption.

This PR adds a conditional runs-on to all 8 jobs in ci.yml:

runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'cachekit-lean' }}

Resolution table:

Event head.repo.fork Result
push: main n/a (no PR object) cachekit-lean
Same-repo PR false cachekit-lean
Fork PR true ubuntu-latest

So internal-author PRs and pushes keep the existing self-hosted scheduling (cheap on org infra), while fork PRs land on GitHub-hosted runners and actually run.

The test-integration job also picks up the same conditional (falls back to ubuntu-latest). Bonus: removes a misleading comment — the job's services.redis is a GHA service container, which works natively on ubuntu-latest. It doesn't require DinD; the original cachekit runner choice was for compute, not Docker.

Why this matters now

Repo is in OSS-prep. As soon as you flip cachekit-ts public, the first fork PR will expose this. Better to land the fix before users hit it.

Why not just use ubuntu-latest everywhere?

That would shift every internal push to GitHub-hosted minutes (~$0.008/min × 8 jobs × every CI run). The self-hosted runners exist specifically to avoid that bill — keeping them for internal traffic and only paying for public runners when actually needed is the cost-rational middle ground.

Test plan

  • actionlint clean (run locally via prek)
  • CI green on this PR (will use cachekit-lean since you have repo access)
  • First fork PR validates the ubuntu-latest fallback (manual verification once public)

Out of scope

  • Branch protection on main (already applied directly via gh API)
  • npm OIDC trusted publishing (separate PR)

Summary by CodeRabbit

  • Chores
    • CI workflow updated to better handle pull requests from forks: standard runners are used for fork-based PRs while optimized runners are retained for other contributions. This change applies across lint, test, coverage, security, smoke-test, integration, and CI-success jobs to ensure consistent behavior and reliable runs for external contributors.

Review Change Stack

GitHub Actions disables self-hosted runners for fork PRs by security
policy — external contributors' PRs would otherwise hang forever on
'waiting for runner'. Adding a conditional runs-on resolves to:

  - same-repo PRs and push: cachekit-lean / cachekit (existing behavior,
    cheap on the self-hosted infra)
  - fork PRs: ubuntu-latest (GitHub-hosted, available to forks)

Applied to all 8 jobs in ci.yml. Also removes the misleading
"needs DinD" comment on test-integration — it uses GHA service
containers, which work natively on ubuntu-latest. The original
cachekit (full self-hosted) was for compute, not Docker.

No new permissions required; the change is a pure scheduler hint.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3db17062-410d-42b3-8d17-b41e44e9e751

📥 Commits

Reviewing files that changed from the base of the PR and between 6e58cb3 and de275e1.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

This PR makes CI jobs fork-aware by using ubuntu-latest for pull requests from forks and the self-hosted cachekit runners otherwise. The test-integration job comment is also updated to explain the fork behavior.

Changes

Fork-aware CI runner selection

Layer / File(s) Summary
Fork-aware runner selection across CI jobs
.github/workflows/ci.yml
runs-on for lint, test, test-integration, coverage, security, smoke-test, and ci-success is changed to a conditional expression that uses ubuntu-latest for fork PRs and cachekit-lean/cachekit otherwise; test-integration comment updated.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • cachekit-io/cachekit-py#91: Updates GitHub Actions workflow runner configuration to adapt CI behavior based on PR source (fork vs. main repository).

Poem

🐰 A fork in the road needs a softer touch,
So ubuntu-latest handles fork PRs with care,
While cachekit runners serve the trusted source,
Each workflow now knows which path to take—
Fork-aware and thoughtful! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: updating CI runner selection to fall back to ubuntu-latest for fork PRs while maintaining cachekit-lean for same-repo activity.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 66: The runs-on expression uses the fallback label 'cachekit' which
differs from other jobs; update the conditional expression that sets runs-on
(the string literal currently 'cachekit') to use the same fallback label
'cachekit-lean' so push/same-repo PRs schedule consistently with other jobs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d04472d3-b2eb-46f7-8402-4dab406e82dd

📥 Commits

Reviewing files that changed from the base of the PR and between f84ce37 and 6e58cb3.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml
# Fork PRs fall back to ubuntu-latest (GHA disables self-hosted runners
# for forks by security policy). The redis service container below works
# on either runner — the original DinD note was misleading.
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'cachekit' }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use the same self-hosted fallback label as other jobs.

Line 66 uses 'cachekit' while the rest of the workflow uses 'cachekit-lean'. This inconsistency can break scheduling for test-integration on push/same-repo PRs if cachekit is not an available label.

Proposed fix
-    runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'cachekit' }}
+    runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'cachekit-lean' }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml at line 66, The runs-on expression uses the
fallback label 'cachekit' which differs from other jobs; update the conditional
expression that sets runs-on (the string literal currently 'cachekit') to use
the same fallback label 'cachekit-lean' so push/same-repo PRs schedule
consistently with other jobs.

The previous comment claimed the DinD note on the original runner choice
was "misleading" — it wasn't. I was wrong.

Verified against ARC runner specs (kubectl get autoscalingrunnerset):
- cachekit:       DOCKER_HOST set, TLS certs mounted, full DinD
- cachekit-lean:  no Docker env, runs as user 1001, service account
                  literally named cachekit-lean-gha-rs-no-permission

The redis service container needs Docker on the host. cachekit-lean
can't host it; only cachekit can. The runner-name difference between
test-integration and every other job is intentional and load-bearing —
flattening to cachekit-lean would break integration tests on internal
runs.

Comment now reflects that constraint accurately so future readers
(including reviewers) don't repeat the suggestion.
@27Bslash6
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@27Bslash6 27Bslash6 merged commit 1cc38db into main May 17, 2026
9 checks passed
@27Bslash6 27Bslash6 deleted the ci/fork-pr-runner-strategy branch May 17, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant