Skip to content
Merged
Show file tree
Hide file tree
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
79 changes: 79 additions & 0 deletions .github/workflows/notion-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,82 @@ jobs:
});
console.log('Created new issue');
}

render-check:
name: Render Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
# wrangler dev requires Node.js 22+
node-version: 24
cache: "npm"

- name: Install dependencies
run: |
npm ci
npx playwright install --with-deps chromium

# Exit code 1 is a rendering regression; 2 means the check could not run
- name: Run render check
id: render
run: |
set +e
npm run check:render 2>&1 | tee render-output.txt
code="${PIPESTATUS[0]}"
echo "exit_code=$code" >> "$GITHUB_OUTPUT"
[ "$code" = "1" ] && exit 0
exit "$code"

- name: Create or update issue if rendering broke
if: steps.render.outputs.exit_code == '1'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const output = fs.readFileSync('render-output.txt', 'utf8');
const date = new Date().toISOString().slice(0, 10);
const body = [
'## Rendering regression detected',
'',
'The daily render check (`npm run check:render`) found features that work on notion.site but break through a generated Worknot worker.',
'',
'```',
output.split('\n').filter((line) => /^(PASS|FAIL|NOTION|SKIP)/.test(line)).join('\n'),
'```',
'',
`Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
].join('\n');

const existing = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'render-regression',
state: 'open',
per_page: 1
});

if (existing.data.length > 0) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existing.data[0].number,
body: `### Update ${date}\n\n` + body
});
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Rendering regression detected - ${date}`,
body: body,
labels: ['render-regression']
});
}

- name: Fail on rendering regression
if: steps.render.outputs.exit_code == '1'
run: exit 1
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Worknot includes automated monitoring for Notion client-side changes that could

When changes are detected, an issue is automatically created. See `scripts/notion-monitor.sh` for details.

The same workflow runs a rendering check (`npm run check:render`, see `scripts/render-check.mjs`). It generates a worker for a public [test page](https://succinct-scar-f20.notion.site/3e6558d7de1781bb89a9fb6adc4012d6), runs it with `wrangler dev`, and loads the page in Chromium. It checks database views, images, PDF and file blocks, Mermaid, anchor links, database items and browser history. Every check also runs against notion.site, and only failures that happen through Worknot alone are reported. To run it locally, run `npx playwright install chromium` first.

## License

MIT
4 changes: 2 additions & 2 deletions baselines/notion-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"notion_version": "23.13.20260925.0853",
"app_js_filename": "app-ab692f49bf1f3e24.js",
"notion_version": "23.13.20260925.1117",
"app_js_filename": "app-601ea34bf19afcb2.js",
"asset_js_count": 1,
"public_domain_name_count": 2,
"notion_site_literal_count": 2,
Expand Down
30 changes: 30 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@types/react": "^19.2.18",
"@types/react-dom": "^19.3.0",
"@vitejs/plugin-react": "^6.1.1",
"playwright": "^1.63.0",
"typescript": "^7.0.2",
"vite": "^8.3.0",
"wrangler": "^4.131.2"
Expand All @@ -33,6 +34,7 @@
"build": "vite build",
"preview": "vite preview",
"dev": "wrangler dev",
"deploy": "wrangler deploy"
"deploy": "wrangler deploy",
"check:render": "node scripts/render-check.mjs"
}
}
Loading
Loading