Skip to content
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

Add CI instructions when strictNullChecks fails due to Messenger #7748

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,53 @@
name: PR
on: pull_request
jobs:
# TODO: remove after https://github.com/pixiebrix/pixiebrix-extension/issues/6526
strictNullMessenger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm
- run: npm ci
- id: tsc
run: |
npm run build:strictNullChecks -- --explainFiles > LOG || {
if grep -q "keyof MessengerMethods" LOG; then
grep -Pazo "\nsrc/(background|contentScript)/messenger/api.ts(\n .+)+" LOG > REASON
cat REASON
{
echo 'reason<<EOF'
# Drop null character at the end caused by -z
cat REASON | sed 's/.$/\n/'
echo 'EOF'
} >> "$GITHUB_OUTPUT"
exit 1
fi
}
- name: Hide previous comment if resolved
uses: marocchino/sticky-pull-request-comment@v2
with:
header: strictNullChecksMessenger # Unique identifier for the comment
hide: true
- name: Add comment with more info if failed
if: failure()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: strictNullChecksMessenger # Unique identifier for the comment
recreate: true
message: |
It looks like one of the non-strict `messenger/api.ts` files ended up being imported by one of the strict files. Don't be fooled by "just a few type errors", this hides hundreds of type errors.

See details and solutions in: https://github.com/pixiebrix/pixiebrix-extension/issues/6526#issuecomment-1926391817

There might be further information about how the non-strict Messenger files are ending up in the strict config:

```
${{ steps.tsc.outputs.reason }}
```

strictNullChecks:
runs-on: ubuntu-latest
steps:
Expand Down
Loading