-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[No QA] Fail patch-package on errors or warnings #44589
Changes from 5 commits
49d875b
5187fe6
e37a91d
bf2b11b
1845b09
7b9ceef
526f18f
502b380
54ebd8b
197d68a
cd6b97d
debcf7a
84585b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Verify patches | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
branches: [main] | ||
paths: ['patches', 'package.json', 'package-lock.json'] | ||
|
||
concurrency: | ||
group: verify-patches-${{ format('{0}-{1}', github.ref, github.sha) || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
verifyPatches: | ||
runs-on: ubuntu-latest | ||
name: Verify patches | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: ./.github/actions/composite/setupNode | ||
|
||
- name: Verify patches | ||
run: ./scripts/verifyPatches.sh |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This patch version matched, it just ended in |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
source "$SCRIPTS_DIR/shellUtils.sh" | ||
|
||
# Run patch-package and capture its output and exit code | ||
TEMP_OUTPUT="$(mktemp)" | ||
npx patch-package --error-on-fail 2>&1 | tee "$TEMP_OUTPUT" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
EXIT_CODE=${PIPESTATUS[0]} | ||
OUTPUT="$(cat "$TEMP_OUTPUT")" | ||
rm -f "$TEMP_OUTPUT" | ||
|
||
# Check if the output contains the warning message | ||
echo "$OUTPUT" | grep -q "patch-package detected a patch file version mismatch" | ||
WARNING_FOUND=$? | ||
|
||
# Determine the final exit code | ||
if [ "$EXIT_CODE" -eq 0 ]; then | ||
if [ $WARNING_FOUND -eq 0 ]; then | ||
# patch-package succeeded but warning was found | ||
error "It looks like you upgraded a dependency without upgrading the patch. Please review the patch, determine if it's still needed, and port it to the new version of the dependency." | ||
exit 1 | ||
else | ||
# patch-package succeeded and no warning was found | ||
success "patch-package succeeded without errors or warnings" | ||
exit 0 | ||
fi | ||
else | ||
# patch-package failed | ||
error "patch-package failed to apply a patch" | ||
exit "$EXIT_CODE" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed without changes. Created upstream PR, which was missing: Expensify/react-native-live-markdown#406