innolitics / n2y

Notion to YAML (and Markdown)
23 stars 1 forks source link

Fix bugs causing our publish-documents workflow to fail #156

Closed russellkan closed 1 year ago

russellkan commented 1 year ago

Context

After merging #155, I manually ran the publish-documents workflow, which failed with a different error: https://github.com/innolitics/innolitics.github.io/actions/runs/6357254369/job/17268129193

This was due to a BulletList being passed here.

To fix this, we first check if the ast is an array, and if so, run filter_linebreaks on that.

After fixing this, a KeyError error occurred in a local run here.

~With the fix, it just logs a warning and returns None:~

The KeyError was caused by the parent page being a database, so the page_id key did not exist. The fix checks the type (which should be one of: workspace, block_id, or page_id) and returns the appropriate parent (None for workspace, database for block_id, and page for page_id.

How Did You Test It