Skip to content

Commit d6af36d

Browse files
committed
feat(ci): add expo doctor results as comment for PR
1 parent 4bda947 commit d6af36d

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

.github/scripts/expo-doctor.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Run expo-doctor and capture output and exit code
4+
output=$(npx expo-doctor@latest 2>&1)
5+
exit_code=$?
6+
7+
# Output file location
8+
output_file=".expo/expo-doctor.md"
9+
{
10+
# Add summary based on exit code
11+
if [ $exit_code -eq 0 ]; then
12+
echo "✅ **Good news!** We ran Expo Doctor for this PR and everything looks good, Great job!" > "$output_file"
13+
else
14+
echo "❌ **Action Required:** We ran Expo Doctor for this PR and found some issues that need to be addressed. Please review the complete report below." > "$output_file"
15+
fi
16+
17+
echo >> "$output_file" # Add blank line
18+
echo "\`\`\`shell" >> "$output_file"
19+
echo "$output" >> "$output_file"
20+
echo "\`\`\`" >> "$output_file"
21+
}
22+
23+
# Show original output in terminal
24+
echo "$output"
25+
26+
# Return the original exit code
27+
exit $exit_code

.github/workflows/expo-doctor.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
doctor:
2828
name: Expo Doctor (expo)
2929
runs-on: ubuntu-latest
30+
permissions:
31+
pull-requests: write
3032

3133
steps:
3234
- name: 📦 Checkout project repo
@@ -38,7 +40,17 @@ jobs:
3840
uses: ./.github/actions/setup-node-pnpm-install
3941

4042
- name: Run prebuild
41-
run: pnpm run prebuild ## we only need to run this to generate the badged icon in `.expo` folder
43+
run: pnpm run prebuild
4244

4345
- name: 🚑 Run Doctor Checks
44-
run: rm -rf ios android && pnpm run doctor ## apprently the new update of expo will break if you already have ios and android folders in your project as they will show up a eas warning
46+
run: |
47+
chmod +x .github/scripts/expo-doctor.sh
48+
rm -rf ios android
49+
.github/scripts/expo-doctor.sh
50+
51+
- name: Add doctor report as comment on PR
52+
if: github.event_name == 'pull_request' && always()
53+
uses: marocchino/sticky-pull-request-comment@v2
54+
with:
55+
header: expo-doctor
56+
path: .expo/expo-doctor.md

0 commit comments

Comments
 (0)