Git Product home page Git Product logo

notion-jam's Introduction

notion-jam

GitHub Action: View on Marketplace Version Downloads CodeFactor Node LICENSE

Sync pages from Notion to GitHub to be used as a static website (JAM)

  • Notion pages are converted to markdown files.
  • Database properties are automatically added as yaml frontmatter
  • All images are downloaded locally and path rewritten to relative paths
  • Page cover is downloaded
  • Thumbnail property is added automatically to the frontmatter using page cover, first image, icon, or image number (configured by post)

Usage

Quick Start

  1. Create a new Notion Integration

    notion secret

  2. Add Notion secret to GitHub repository

    1. Go to github.com/{user}/{repo}/settings/secrets/actions

    2. Set NOTION_SECRET of Notion to your repository secret.

      add notion secret to github

  3. Share the Database with the integration

    add perm

  4. Create a workflow in .github/workflows/**.yml of your repository

    Example Workflow

    # This is a basic workflow to help you get started with Actions
    
    name: NotionJAM
    
    # Controls when the workflow will run
    on:
      schedule:
        - cron: "0 21 * * *" # daily
      push:
        branches: [master, main]
    
      # Allows you to run this workflow manually from the Actions tab
      workflow_dispatch:
    
    # A workflow run is made up of one or more jobs that can run sequentially or in parallel
    jobs:
      # This workflow contains a single job called "build"
      build:
        # The type of runner that the job will run on
        runs-on: ubuntu-latest
    
        # Steps represent a sequence of tasks that will be executed as part of the job
        steps:
          # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
          - uses: actions/checkout@v3
    
          - name: notion-jam
            uses: victornpb/[email protected]
            with:
              NOTION_SECRET: ${{ secrets.NOTION_SECRET }}
              NOTION_DATABASE: https://www.notion.so/9e34cee9f5bd4c4aaf0d2eaf73ead47b
              FILTER_PROP: Status
              FILTER_VALUES: Published
              CONVERT_PROP_CASE: snake
              ARTICLE_PATH: content/posts/{title}/README.md
              ASSETS_PATH: ./
              PARALLEL_PAGES: 25
              PARALLEL_DOWNLOADS_PER_PAGE: 3
              DOWNLOAD_IMAGE_TIMEOUT: 30
              SKIP_DOWNLOADED_IMAGES: true
              DOWNLOAD_FRONTMATTER_IMAGES: true
          
          - name: Save changes
            uses: stefanzweifel/git-auto-commit-action@v4
            with:
              commit_message: Commit changes

Configuration

Parameters

Name Description Required Default
NOTION_SECRET Notion API Token secret โœ…
NOTION_DATABASE Notion Database URL or ID (example: https://notion.so/00112233445566778899aabbccddeeff) โœ…
FILTER_PROP Property on the database used to query pages Status
FILTER_VALUES Return pages with the FILTER_PROP is equal this list of values Ready,Published
CONVERT_PROP_CASE Convert the database property names before adding to the frontmatter (camel,pascal,kebab,snake,none) snake
ARTICLE_PATH Path template to where to save markdown files posts/{title}/README.md
ASSETS_PATH Path to save images, if started with . will be relative to ARTICLE_PATH, otherwise absolute ./
PARALLEL_PAGES Fetch this amount of pages in parallel 25
PARALLEL_DOWNLOADS_PER_PAGE Number of images to download in parallel for each page 3
DOWNLOAD_IMAGE_TIMEOUT Timeout in seconds for each image download 30
SKIP_DOWNLOADED_IMAGES Skip downloading images if they already exist in the path true
DOWNLOAD_FRONTMATTER_IMAGES Downloads image urls in the frontmatter true

notion-jam's People

Contributors

victornpb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

notion-jam's Issues

Does Notion properties now starts with lowercase?

Hi,

I see that this Github Action does not work by default. In my case, the issue is related to the database's properties. My Notion properties are lowercase by default e.g.status instead of Status.

I see there's a transformation function but it's not applied here.

I'm not a Notion expert and I don't know if it worked 2 years ago (based on your commit changes) or if this is a bug. Could you confirm that?

Best

P.S
Thank you for your commitment to this repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.