Skip to content

Commit 5ec5e07

Browse files
yjoseasdolo
authored andcommitted
feat(ci): add expo doctor results as comment for PR
1 parent fac246c commit 5ec5e07

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
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: 12 additions & 1 deletion
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,4 +40,13 @@ jobs:
3840
uses: ./.github/actions/setup-node-pnpm-install
3941

4042
- name: 🚑 Run Doctor Checks
41-
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
43+
run: |
44+
chmod +x .github/scripts/expo-doctor.sh
45+
.github/scripts/expo-doctor.sh
46+
47+
- name: Add doctor report as comment on PR
48+
if: github.event_name == 'pull_request' && always()
49+
uses: marocchino/sticky-pull-request-comment@v2
50+
with:
51+
header: expo-doctor
52+
path: .expo/expo-doctor.md

0 commit comments

Comments
 (0)