Skip to content
git-pull-request

GitHub Action

Sync Github PRs to Notion

1.0.0 Latest version

Sync Github PRs to Notion

git-pull-request

Sync Github PRs to Notion

Update Notion when there is a new Github issue or an update to it

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Sync Github PRs to Notion

uses: sivashanmukh/[email protected]

Learn more about this action in sivashanmukh/github-notion-pr-sync

Choose a version

Sample Integration: GitHub Issues to Notion

drawing

About the Integration

This Notion integration syncs GitHub Pull Requests for a specific repo to a Notion Database. This integration was built using this database template and GitHub's Octokit Library. Changes made to pull requests in the Notion database will not be reflected in GitHub. For an example which allows you to take actions based on changes in a database go here.

Setting up

  1. Duplicate this template into your notion workspace:

  2. You can create your Notion API key here.

  3. Make sure you share the local copy of the template created in Step 1 with the integration created in Step 2

  4. You can create your GitHub Personal Access token by following the guide here

  5. You can find the Notion database id of the page you have created using these instructions

  6. Create an action yaml file with the following contents and with the corresponding values filled in and push it in root_path/.github/workflows folder of your repo

        name: Sync Github Prs to Notion
        
        on:
          issues:
            types: [opened, edited, deleted, transferred, pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled, locked, unlocked, milestoned, demilestoned]
          pull_request:
            types: [assigned, unassigned, labeled, unlabeled, opened, edited, closed, reopened, synchronize, converted_to_draft, ready_for_review, locked, unlocked, review_requested, review_request_removed, auto_merge_enabled, auto_merge_disabled]
        
        jobs:
          sync:
            runs-on: ubuntu-latest
            steps:
            - name: Sync Github PRs to Notion
              uses: sivashanmukh/[email protected]
              with:
                notionKey: <generated in step 2>
                notionDatabaseId: <found in step 5>
                githubKey: <generated in step 4>
    

Running Locally

1. Setup your local project

# Clone this repository locally
git clone https://github.com/sivashanmukh/github-notion-pr-sync

# Install the dependencies
npm install

2. Set your environment variables in a .env file

GITHUB_KEY=<your-github-personal-access-token>
NOTION_KEY=<your-notion-api-key>
NOTION_DATABASE_ID=<notion-database-id>
GITHUB_REPO_OWNER=<github-owner-username>
GITHUB_REPO_NAME=<github-repo-name>

You can create your Notion API key here.

You can create your GitHub Personal Access token by following the guide here.

To create a Notion database that will work with this example, duplicate this empty database template.

3. Run code

node index.js