Skip to content

Commit 710cd45

Browse files
authored
Create a single, fan-in action (#2710)
Allows only requiring a single job in branch protection which allows changing the required jobs in PRs.
1 parent f2761a2 commit 710cd45

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

.github/workflows/build.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ jobs:
196196
- name: Build TestApp iOS (UIKit)
197197
run: xcodebuild -project test-app/ios-uikit/TestApp.xcodeproj -scheme TestApp -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest'
198198

199-
publish:
200-
runs-on: macos-latest
201-
if: ${{ github.ref == 'refs/heads/trunk' && github.repository == 'cashapp/redwood' }}
199+
final-status:
200+
if: ${{ !cancelled() }}
201+
runs-on: ubuntu-latest
202202
needs:
203203
- build
204204
- dokka
@@ -209,6 +209,20 @@ jobs:
209209
- sample-emoji
210210
- sample-emoji-emulator
211211
- test-app
212+
steps:
213+
- name: Check
214+
run: |
215+
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
216+
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
217+
echo "One or more required jobs failed"
218+
exit 1
219+
fi
220+
221+
publish:
222+
runs-on: macos-latest
223+
if: ${{ github.ref == 'refs/heads/trunk' && github.repository == 'cashapp/redwood' }}
224+
needs:
225+
- final-status
212226
steps:
213227
- uses: actions/checkout@v4
214228

0 commit comments

Comments
 (0)