@heritageholdings/danger-plugin-notion-tasks
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

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.

Package Sidebar

Install

npm i @heritageholdings/danger-plugin-notion-tasks

Weekly Downloads

2

Version

0.1.3

License

MIT

Unpacked Size

40.7 kB

Total Files

14

Last publish

Collaborators

  • dgopsq
  • cloudify