Skip to content

Commit 6f13b6b

Browse files
authored
Check integration test for presubmit instruction (#368)
1 parent e0a5ba4 commit 6f13b6b

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

.github/workflows/integration_tests.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,48 @@ on:
99

1010
jobs:
1111

12+
grab-pr-body:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
PR_BODY: ${{ steps.body.outputs.PR_BODY }}
16+
steps:
17+
- id: body
18+
env:
19+
PR_BODY: ${{ github.event.pull_request.body }}
20+
run: |
21+
{
22+
echo "PR_BODY<<EOF"
23+
echo "$PR_BODY"
24+
echo "EOF"
25+
} >> "$GITHUB_OUTPUT"
26+
27+
check-pr-body-for-key:
28+
runs-on: ubuntu-latest
29+
needs: grab-pr-body
30+
outputs:
31+
RUN_INTEGRATION: ${{ steps.check_key.outputs.RUN_INTEGRATION }}
32+
steps:
33+
- id: check_key
34+
env:
35+
PR_BODY: ${{ needs.grab-pr-body.outputs.PR_BODY }}
36+
SKIP_KEY: "SKIP_INTEGRATION_TESTS=YES"
37+
name: Check for key and set bool to skip integration tests
38+
run: |
39+
if [[ "$PR_BODY" == *"$SKIP_KEY"* ]]; then
40+
echo "Skipping integration tests for PR body:"
41+
echo "$PR_BODY"
42+
echo "RUN_INTEGRATION=no" >> "$GITHUB_OUTPUT"
43+
else
44+
echo "Running integration tests for PR body:"
45+
echo "$PR_BODY"
46+
echo "RUN_INTEGRATION=yes" >> "$GITHUB_OUTPUT"
47+
fi
48+
1249
swift-button-functional-test:
1350
runs-on: macOS-12
51+
needs: check-pr-body-for-key
1452
# Don't run if triggered by a PR from a fork since our Secrets won't be provided to the runner.
15-
if: false # Disabled per issue 367; add back here check for PRs from forks
53+
if: ${{ needs.check-pr-body-for-key.outputs.RUN_INTEGRATION == 'yes' }} && "!github.event.pull_request.head.repo.fork"
1654
defaults:
1755
run:
1856
working-directory: Samples/Swift/DaysUntilBirthday

0 commit comments

Comments
 (0)