Skip to content

Commit 802abd4

Browse files
committed
Run cherry-picked actions on draft PRs
1 parent ce29f88 commit 802abd4

3 files changed

Lines changed: 54 additions & 11 deletions

File tree

.github/workflows/android-test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@ name: Android — Lint, Build & Run Tests
22

33
on:
44
workflow_call:
5+
inputs:
6+
ready:
7+
description: When false, skip non-draft-only jobs (the sample app build).
8+
required: false
9+
type: boolean
10+
default: true
511
workflow_dispatch:
12+
inputs:
13+
ready:
14+
description: When false, skip non-draft-only jobs (the sample app build).
15+
required: false
16+
type: boolean
17+
default: true
618

719
permissions:
820
contents: read
@@ -31,6 +43,8 @@ jobs:
3143
run: ./gradlew test --console=plain
3244

3345
build:
46+
# Sample app build is deferred to non-draft PRs.
47+
if: ${{ inputs.ready }}
3448
runs-on: ubuntu-latest
3549

3650
steps:

.github/workflows/ci.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ on:
55
branches:
66
- main
77
pull_request:
8-
# ready_for_review starts CI when a draft PR becomes ready; converted_to_draft
9-
# creates a skipped run that cancels any in-progress CI for the same PR ref.
8+
# Draft PRs run a reduced suite: the fast ubuntu lint/test jobs. The
9+
# expensive macOS/simulator and sample-build jobs are gated to non-draft
10+
# PRs via the changes.ready output. ready_for_review promotes a draft to the
11+
# full suite; converted_to_draft re-runs the reduced suite and cancels any
12+
# in-progress full run for the same PR ref.
1013
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
1114
workflow_dispatch:
1215

@@ -25,9 +28,11 @@ concurrency:
2528
jobs:
2629
changes:
2730
name: Detect Changed Areas
28-
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
2931
runs-on: ubuntu-latest
3032
outputs:
33+
# true for pushes and non-draft PRs; false for draft PRs. Gates the
34+
# expensive macOS/simulator and sample-build jobs off draft PRs.
35+
ready: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
3136
android: ${{ steps.platform.outputs.android == 'true' || steps.platform.outputs.protocol == 'true' || steps.infra.outputs.android == 'true' }}
3237
swift: ${{ steps.platform.outputs.swift == 'true' || steps.platform.outputs.protocol == 'true' || steps.infra.outputs.swift == 'true' }}
3338
reactNative: ${{ steps.platform.outputs.reactNative == 'true' || steps.platform.outputs.swift == 'true' || steps.platform.outputs.android == 'true' || steps.platform.outputs.protocol == 'true' || steps.infra.outputs.reactNativeCommon == 'true' || steps.infra.outputs.reactNativeIos == 'true' || steps.infra.outputs.reactNativeAndroid == 'true' }}
@@ -101,24 +106,28 @@ jobs:
101106
needs: changes
102107
if: needs.changes.outputs.android == 'true'
103108
uses: ./.github/workflows/android-test.yml
109+
with:
110+
ready: ${{ needs.changes.outputs.ready == 'true' }}
104111

105112
swift-test-package:
106113
name: Swift
107114
needs: changes
108-
if: needs.changes.outputs.swift == 'true'
115+
if: needs.changes.outputs.swift == 'true' && needs.changes.outputs.ready == 'true'
109116
uses: ./.github/workflows/swift-test-package.yml
110117

111118
swift-build-samples:
112119
name: Swift
113120
needs: changes
114-
if: needs.changes.outputs.swift == 'true'
121+
if: needs.changes.outputs.swift == 'true' && needs.changes.outputs.ready == 'true'
115122
uses: ./.github/workflows/swift-build-samples.yml
116123

117124
swift-lint:
118125
name: Swift
119126
needs: changes
120127
if: needs.changes.outputs.swift == 'true'
121128
uses: ./.github/workflows/swift-lint.yml
129+
with:
130+
ready: ${{ needs.changes.outputs.ready == 'true' }}
122131

123132
swift-sample-package-paths:
124133
name: Swift Sample Package Paths
@@ -141,25 +150,25 @@ jobs:
141150
rn-test-android:
142151
name: React Native
143152
needs: changes
144-
if: needs.changes.outputs.reactNativeAndroid == 'true'
153+
if: needs.changes.outputs.reactNativeAndroid == 'true' && needs.changes.outputs.ready == 'true'
145154
uses: ./.github/workflows/rn-test-android.yml
146155

147156
rn-test-ios:
148157
name: React Native
149158
needs: changes
150-
if: needs.changes.outputs.reactNativeIos == 'true'
159+
if: needs.changes.outputs.reactNativeIos == 'true' && needs.changes.outputs.ready == 'true'
151160
uses: ./.github/workflows/rn-test-ios.yml
152161

153162
rn-build-android:
154163
name: React Native
155164
needs: changes
156-
if: needs.changes.outputs.reactNativeAndroid == 'true'
165+
if: needs.changes.outputs.reactNativeAndroid == 'true' && needs.changes.outputs.ready == 'true'
157166
uses: ./.github/workflows/rn-build-android.yml
158167

159168
rn-build-ios:
160169
name: React Native
161170
needs: changes
162-
if: needs.changes.outputs.reactNativeIos == 'true'
171+
if: needs.changes.outputs.reactNativeIos == 'true' && needs.changes.outputs.ready == 'true'
163172
uses: ./.github/workflows/rn-build-ios.yml
164173

165174
rn-check-packed-files:
@@ -192,7 +201,9 @@ jobs:
192201
needs.changes.outputs.reactNative == 'true'
193202
uses: ./.github/workflows/breaking-changes.yml
194203
with:
195-
swift: ${{ needs.changes.outputs.swift }}
204+
# Swift API baseline runs on macOS — defer to non-draft PRs. The Android
205+
# and React Native baselines are cheap ubuntu jobs and run on drafts.
206+
swift: ${{ needs.changes.outputs.swift == 'true' && needs.changes.outputs.ready == 'true' }}
196207
android: ${{ needs.changes.outputs.android }}
197208
react-native: ${{ needs.changes.outputs.reactNative }}
198209

@@ -201,7 +212,9 @@ jobs:
201212
# because no files in that platform's tree changed.
202213
ci-required:
203214
name: CI Required
204-
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
215+
# Runs on drafts too, aggregating whichever jobs ran. Ready-only jobs report
216+
# "skipped" on drafts, which this gate treats as a pass.
217+
if: always()
205218
needs:
206219
- changes
207220
- android-test

.github/workflows/swift-lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@ name: Swift — Lint
22

33
on:
44
workflow_call:
5+
inputs:
6+
ready:
7+
description: When false, skip the macOS-only jobs (SwiftFormat, CocoaPods).
8+
required: false
9+
type: boolean
10+
default: true
511
workflow_dispatch:
12+
inputs:
13+
ready:
14+
description: When false, skip the macOS-only jobs (SwiftFormat, CocoaPods).
15+
required: false
16+
type: boolean
17+
default: true
618

719
permissions:
820
contents: read
@@ -20,6 +32,8 @@ jobs:
2032

2133
swiftformat:
2234
name: SwiftFormat & SwiftLint
35+
# macOS runner — deferred to non-draft PRs.
36+
if: ${{ inputs.ready }}
2337
runs-on: ${{ vars.MACOS_RUNNER }}
2438
env:
2539
MINT_PATH: ${{ github.workspace }}/.mint/lib
@@ -53,6 +67,8 @@ jobs:
5367

5468
lint-podspec:
5569
name: CocoaPods
70+
# macOS runner — deferred to non-draft PRs.
71+
if: ${{ inputs.ready }}
5672
runs-on: ${{ vars.MACOS_RUNNER }}
5773
env:
5874
BUNDLE_GEMFILE: ${{ github.workspace }}/platforms/swift/Gemfile

0 commit comments

Comments
 (0)