Skip to content

heritageholdings/danger-plugin-notion-tasks

Repository files navigation

danger-plugin-notion-tasks

npm version

This Danger plugin manages Notion pages automatically based on a Pull Request status.

Quickstart

Notion setup

First of all an Internal Integration Token is needed in order to manage the connection between GitHub and Notion. Follow the steps in this tutorial to generate one and store the token for later.

Now create a Notion page with a Status status property and a Pull Request url property. The most common scenario is a database of tasks where each task is a page with the described properties among others:

Notion page required properties

Configuration

  1. Install the danger-plugin-notion-tasks plugin using your favourite package manager:
// Yarn
yarn add --dev @heritageholdings/danger-plugin-notion-tasks

// NPM
npm install -D @heritageholdings/danger-plugin-notion-tasks
  1. Add the following code to your dangerfile:
notionSync({
  // This should be the user that owns the pages.
  //
  // For example:
  // https://www.notion.so/this-is-the-username/Page-1069eef615114va810dfg797219147fb
  //                       --------------------
  notionUser: "notion-page-username",

  // How the page's Status should be changed
  // based on the Pull Request lifecycle.
  prStatusMap: {
    open: "In progress",
    closed: "Done",
    merged: "Done",
    locked: "Done",
  },
});
  1. Make the Danger bot run everytime a Pull Request changes:
on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - edited
      - closed
  1. In your GitHub repo add a new GitHub Secret NOTION_TOKEN with the token generated in the previous section from Notion.

Trigger

Create a new Pull Request and add everywhere in the description:

Closes https://www.notion.so/this-is-the-username/Your-Notion-Page-1069eef615114va810dfg797219147fb

This Notion page will be recognized by the Danger bot and managed based on the PR status. For example, opening the PR will change the page Status to In progress and merging it to Done following the default configuration above. The PR link will be also added to the Pull Request property.

In this case closes (not case sensitive) is one of the default keywords used by this plugin to recognize a target Notion page. By default all the GitHub keywords are supported, but it's possible to change them through the triggerWords setting.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •