A Github action for updating a block in notion.
- Create a new internal Notion integration and store the API token as a secret in Github for your workflow.
- In the Notion page of the block you'll be updating, connect your newly created integration in the via the page settings.
- Copy the link to block to find the block id. Using the following link as an example, the block id would be the value after the #:
https://www.notion.so/workspacename/Page-to-Update-with-API-eaf76050asdd944506e5da7fa9?pvs=4#1cd2c86a1a2042668dcbdd531d065b87
name: Update notion block
on: workflow_dispatch
jobs:
notion_job:
runs-on: ubuntu-latest
name: Update notion block
steps:
- name: Update Notion Block from Github
uses: braedongough/update-notion-block@v1.0.0
with:
notion_token: ${{ secrets.NOTION_TOKEN }}
block_id: 7a94c1bcc03646dbac15494ebd7a5d6d
data: '{"type": "paragraph", "paragraph": {"rich_text": [{"text": {"content": "Updated from github"}, "annotations": {"color": "yellow"}}]}}'
note: The data type must be the same block type as the block you're updating.