Skip to content

Commit cf0f0b4

Browse files
committed
fix(ci): forkの検証ランナーを修正
専用ランナーのない公開forkでも上流と同じ検証を実行できるようにする。上流固定の自動処理は上流リポジトリに限定する。 Refs: #357 Agent-Lane: codex
1 parent b98f042 commit cf0f0b4

11 files changed

Lines changed: 122 additions & 10 deletions

File tree

‎.github/workflows/check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
check:
1717
name: typecheck
1818
if: ${{ !github.event.pull_request.draft }}
19-
runs-on: blacksmith-4vcpu-ubuntu-2404
19+
runs-on: ${{ github.repository == 'anomalyco/opencode' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }}
2020
steps:
2121
- name: Checkout repository
2222
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

‎.github/workflows/close-issues.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
close:
10+
if: github.repository == 'anomalyco/opencode'
1011
runs-on: ubuntu-latest
1112
permissions:
1213
contents: read

‎.github/workflows/close-prs.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717

1818
jobs:
1919
close:
20+
if: github.repository == 'anomalyco/opencode'
2021
runs-on: ubuntu-latest
2122
timeout-minutes: 240
2223
permissions:

‎.github/workflows/guardrails.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ on:
77
paths:
88
- "packages/guardrails/**"
99
- "scripts/sync-model-whitelist.py"
10-
- ".github/workflows/guardrails.yml"
10+
- ".github/workflows/**"
1111
push:
1212
branches: [dev]
1313
paths:
1414
- "packages/guardrails/**"
1515
- "scripts/sync-model-whitelist.py"
16+
- ".github/workflows/**"
1617

1718
permissions:
1819
contents: read

‎.github/workflows/nix-eval.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818
jobs:
1919
nix-eval:
2020
if: ${{ !github.event.pull_request.draft }}
21-
runs-on: blacksmith-4vcpu-ubuntu-2404
21+
runs-on: ${{ github.repository == 'anomalyco/opencode' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }}
2222
timeout-minutes: 15
2323
steps:
2424
- name: Checkout repository

‎.github/workflows/nix-hashes.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
# Native runners required: bun install cross-compilation flags (--os/--cpu)
2727
# do not produce byte-identical node_modules as native installs.
2828
compute-hash:
29+
if: github.repository == 'anomalyco/opencode'
2930
strategy:
3031
fail-fast: false
3132
matrix:
@@ -89,7 +90,7 @@ jobs:
8990

9091
update-hashes:
9192
needs: compute-hash
92-
if: github.event_name != 'pull_request'
93+
if: github.repository == 'anomalyco/opencode' && github.event_name != 'pull_request'
9394
runs-on: blacksmith-4vcpu-ubuntu-2404
9495

9596
steps:

‎.github/workflows/storybook.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
build:
3131
name: storybook build
3232
if: ${{ !github.event.pull_request.draft }}
33-
runs-on: blacksmith-4vcpu-ubuntu-2404
33+
runs-on: ${{ github.repository == 'anomalyco/opencode' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }}
3434
steps:
3535
- name: Checkout repository
3636
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

‎.github/workflows/test.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
affected:
2626
name: affected packages
2727
if: ${{ !github.event.pull_request.draft }}
28-
runs-on: blacksmith-4vcpu-ubuntu-2404
28+
runs-on: ${{ github.repository == 'anomalyco/opencode' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }}
2929
outputs:
3030
e2e: ${{ steps.packages.outputs.app }}
3131
steps:
@@ -66,7 +66,7 @@ jobs:
6666
host: blacksmith-4vcpu-ubuntu-2404
6767
- name: windows
6868
host: blacksmith-4vcpu-windows-2025
69-
runs-on: ${{ matrix.settings.host }}
69+
runs-on: ${{ github.repository == 'anomalyco/opencode' && matrix.settings.host || (matrix.settings.name == 'windows' && 'windows-2025' || 'ubuntu-24.04') }}
7070
defaults:
7171
run:
7272
shell: bash
@@ -152,7 +152,7 @@ jobs:
152152
host: blacksmith-4vcpu-ubuntu-2404
153153
- name: windows
154154
host: blacksmith-4vcpu-windows-2025
155-
runs-on: ${{ matrix.settings.host }}
155+
runs-on: ${{ github.repository == 'anomalyco/opencode' && matrix.settings.host || (matrix.settings.name == 'windows' && 'windows-2025' || 'ubuntu-24.04') }}
156156
defaults:
157157
run:
158158
shell: bash
@@ -231,7 +231,7 @@ jobs:
231231
shard: 2/2
232232
- id: session-ui-components
233233
- id: app-components
234-
runs-on: ${{ matrix.settings.host }}
234+
runs-on: ${{ github.repository == 'anomalyco/opencode' && matrix.settings.host || (matrix.settings.name == 'windows' && 'windows-2025' || 'ubuntu-24.04') }}
235235
env:
236236
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
237237
defaults:
@@ -327,7 +327,7 @@ jobs:
327327
fail-fast: false
328328
matrix:
329329
os: [linux, windows]
330-
runs-on: blacksmith-4vcpu-ubuntu-2404
330+
runs-on: ${{ github.repository == 'anomalyco/opencode' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }}
331331
steps:
332332
- name: Check browser test results
333333
env:

‎.github/workflows/triage.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
jobs:
88
triage:
9+
if: github.repository == 'anomalyco/opencode'
910
runs-on: blacksmith-4vcpu-ubuntu-2404
1011
permissions:
1112
contents: read

‎packages/guardrails/FORK_CI.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Fork の CI 実行環境
2+
3+
Cor-Incorporated/opencode は公開 fork で、2026-11-04 時点の登録 runner は 0 台だった。
4+
上流の Blacksmith ラベルをそのまま要求した PR #356 の typecheck、unit、build、Nix は
5+
runner_id=0 のまま待機し、24 時間後に cancelled となっていた。
6+
7+
検証 workflow の job と実行コマンドは維持し、上流では従来の Blacksmith を使い、fork では
8+
GitHub 標準の `ubuntu-24.04` / `windows-2025` を使う。Linux と Windows の matrix、
9+
affected 判定、browser test、集約 check を省略しない。公開リポジトリの標準 runner が対象で、
10+
larger runner、新サービス、追加 secret は使用しない。
11+
12+
`close-prs` の失敗 run 41727034808 は、固定対象 `anomalyco/opencode` の PR を 1,428 件取得後、
13+
fork の GITHUB_TOKEN での更新が 403 となっていた。`close-issues` も上流を固定対象にする。
14+
これらの job、上流の有料モデルを使う issue triage、上流 App secret で更新する Nix hash の
15+
job は上流リポジトリでのみ起動する。`context.repo` を対象とする fork の compliance 処理は残す。
16+
release / deploy workflow はこの変更の対象外。
17+
18+
検査は `packages/guardrails` で実行する。
19+
20+
```sh
21+
bun test profile/src/fork-ci.test.ts
22+
```
23+
24+
このテストは実際の YAML にある runner / job 条件式を、上流と fork、Linux と Windows の
25+
コンテキストで評価する。API 呼び出し、PR の close、メッセージ送信は行わない。
26+
workflow の変更も `guardrails.yml` を起動するため、runner の設定だけが戻る変更を検出できる。
27+
upstream の `test.yml` → `check-test.yml`、`nix-eval.yml` → `check-nix.yml`、triage の rename 後も
28+
同じ条件式を移し、旧ファイルを復活させない。
29+
30+
撤収条件は、fork 側で上流ラベルを使える runner が存在し、同一 SHA の全対象 job が待機せず
31+
20 回連続で成功するか、上流自体が標準 runner を選択すること。実測と撤収 PR で fallback を外す。
32+
33+
構造変更の H5 検査は既存 `scripts/h5-admission-check.sh` が担当する。構造 PR の証跡不足では
34+
同スクリプトの block 分岐から `H5_LEDGER_PATH`(既定 `guard-ledger.jsonl`)へ追記される。
35+
runner の既知不正値は本テストで red にし、H5 の ledger 接続は一時 ledger による陰性検査で確認する。

0 commit comments

Comments
 (0)