Skip to content

Commit a6133b0

Browse files
Remove fork PR guards from CI workflows (manaflow-ai#2092)
* Remove fork PR guards from CI workflows Fork PRs are already gated by GitHub's "Require approval for outside collaborators" setting. The workflow-level guards were redundant and prevented WarpBuild jobs from running even after maintainer approval. * Address review feedback: extend guard test, skip upload on fork PRs - Guard test now covers build-ghosttykit.yml and ci-macos-compat.yml (not just ci.yml) - Skip xcframework upload when GHOSTTY_RELEASE_TOKEN is unavailable (fork PRs), so the build still validates without failing at publish * Check GHOSTTY_RELEASE_TOKEN at runtime instead of step if secrets context can't be reliably used in step if: conditions. Check the env var inside the script instead. --------- Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
1 parent b0f2701 commit a6133b0

4 files changed

Lines changed: 32 additions & 55 deletions

File tree

.github/workflows/build-ghosttykit.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ concurrency:
1212

1313
jobs:
1414
build-ghosttykit:
15-
# Never run WarpBuild jobs for fork pull requests (avoid billing on external PRs).
16-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
1715
runs-on: warp-macos-15-arm64-6x
1816
timeout-minutes: 20
1917
steps:
@@ -95,6 +93,10 @@ jobs:
9593
GH_TOKEN: ${{ secrets.GHOSTTY_RELEASE_TOKEN }}
9694
run: |
9795
set -euo pipefail
96+
if [ -z "${GH_TOKEN:-}" ]; then
97+
echo "GHOSTTY_RELEASE_TOKEN not available (fork PR), skipping upload"
98+
exit 0
99+
fi
98100
TAG="xcframework-${{ steps.ghostty-sha.outputs.sha }}"
99101
gh release create "$TAG" \
100102
--repo manaflow-ai/ghostty \

.github/workflows/ci-macos-compat.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ on:
88

99
jobs:
1010
compat-tests:
11-
# Only run for the repo itself, not forks (GhosttyKit download needs repo access).
12-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
1311
strategy:
1412
fail-fast: false
1513
matrix:

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ jobs:
7575
run: bun tsc --noEmit
7676

7777
tests:
78-
# Never run WarpBuild jobs for fork pull requests (avoid billing on external PRs).
79-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
8078
runs-on: warp-macos-15-arm64-6x
8179
timeout-minutes: 30
8280
steps:
@@ -241,7 +239,6 @@ jobs:
241239
# Keep lag validation separate from UI regressions so functional UI failures
242240
# and performance regressions stay isolated. Broader interactive UI suites
243241
# still run via test-e2e.yml on GitHub-hosted runners.
244-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
245242
runs-on: warp-macos-15-arm64-6x
246243
timeout-minutes: 20
247244
steps:
@@ -404,7 +401,6 @@ jobs:
404401
rm -f /tmp/create-virtual-display
405402
406403
ui-regressions:
407-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
408404
runs-on: warp-macos-15-arm64-6x
409405
timeout-minutes: 25
410406
steps:

tests/test_ci_self_hosted_guard.sh

Lines changed: 28 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,37 @@
11
#!/usr/bin/env bash
22
# Regression test for https://github.com/manaflow-ai/cmux/issues/385.
3-
# Ensures paid/gated CI jobs are never run for fork pull requests.
3+
# Ensures paid CI jobs use WarpBuild runners.
4+
# Fork PRs are gated by GitHub's built-in "Require approval for outside
5+
# collaborators" setting, so workflow-level fork guards are not needed.
46
set -euo pipefail
57

68
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
7-
WORKFLOW_FILE="$ROOT_DIR/.github/workflows/ci.yml"
9+
CI_FILE="$ROOT_DIR/.github/workflows/ci.yml"
10+
GHOSTTYKIT_FILE="$ROOT_DIR/.github/workflows/build-ghosttykit.yml"
11+
COMPAT_FILE="$ROOT_DIR/.github/workflows/ci-macos-compat.yml"
812

9-
EXPECTED_IF="if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository"
13+
check_warp_runner() {
14+
local file="$1" job="$2"
15+
if ! awk -v job="$job" '
16+
$0 ~ "^ "job":" { in_job=1; next }
17+
in_job && /^ [^[:space:]]/ { in_job=0 }
18+
in_job && /runs-on:.*warp-macos-.*-arm64/ { saw_warp=1 }
19+
in_job && /os: warp-macos-.*-arm64/ { saw_warp=1 }
20+
END { exit !(saw_warp) }
21+
' "$file"; then
22+
echo "FAIL: $job in $(basename "$file") must use a WarpBuild runner"
23+
exit 1
24+
fi
25+
echo "PASS: $job WarpBuild runner is present"
26+
}
1027

11-
if ! grep -Fq "$EXPECTED_IF" "$WORKFLOW_FILE"; then
12-
echo "FAIL: Missing fork pull_request guard in $WORKFLOW_FILE"
13-
echo "Expected line:"
14-
echo " $EXPECTED_IF"
15-
exit 1
16-
fi
28+
# ci.yml jobs
29+
check_warp_runner "$CI_FILE" "tests"
30+
check_warp_runner "$CI_FILE" "tests-build-and-lag"
31+
check_warp_runner "$CI_FILE" "ui-regressions"
1732

18-
# tests: must use WarpBuild runner with fork guard (paid runner)
19-
if ! awk '
20-
/^ tests:/ { in_tests=1; next }
21-
in_tests && /^ [^[:space:]]/ { in_tests=0 }
22-
in_tests && /runs-on: warp-macos-15-arm64-6x/ { saw_warp=1 }
23-
in_tests && /github.event.pull_request.head.repo.full_name == github.repository/ { saw_guard=1 }
24-
END { exit !(saw_warp && saw_guard) }
25-
' "$WORKFLOW_FILE"; then
26-
echo "FAIL: tests block must keep both warp-macos-15-arm64-6x runner and fork guard"
27-
exit 1
28-
fi
33+
# build-ghosttykit.yml
34+
check_warp_runner "$GHOSTTYKIT_FILE" "build-ghosttykit"
2935

30-
# tests-build-and-lag: must use WarpBuild runner with fork guard (paid runner)
31-
if ! awk '
32-
/^ tests-build-and-lag:/ { in_tests=1; next }
33-
in_tests && /^ [^[:space:]]/ { in_tests=0 }
34-
in_tests && /runs-on: warp-macos-15-arm64-6x/ { saw_warp=1 }
35-
in_tests && /github.event.pull_request.head.repo.full_name == github.repository/ { saw_guard=1 }
36-
END { exit !(saw_warp && saw_guard) }
37-
' "$WORKFLOW_FILE"; then
38-
echo "FAIL: tests-build-and-lag block must keep both warp-macos-15-arm64-6x runner and fork guard"
39-
exit 1
40-
fi
41-
42-
# ui-regressions: must use WarpBuild runner with fork guard (paid runner)
43-
if ! awk '
44-
/^ ui-regressions:/ { in_tests=1; next }
45-
in_tests && /^ [^[:space:]]/ { in_tests=0 }
46-
in_tests && /runs-on: warp-macos-15-arm64-6x/ { saw_warp=1 }
47-
in_tests && /github.event.pull_request.head.repo.full_name == github.repository/ { saw_guard=1 }
48-
END { exit !(saw_warp && saw_guard) }
49-
' "$WORKFLOW_FILE"; then
50-
echo "FAIL: ui-regressions block must keep both warp-macos-15-arm64-6x runner and fork guard"
51-
exit 1
52-
fi
53-
54-
echo "PASS: tests WarpBuild runner fork guard is present"
55-
echo "PASS: tests-build-and-lag WarpBuild runner fork guard is present"
56-
echo "PASS: ui-regressions WarpBuild runner fork guard is present"
36+
# ci-macos-compat.yml (uses matrix.os with WarpBuild runners)
37+
check_warp_runner "$COMPAT_FILE" "compat-tests"

0 commit comments

Comments
 (0)