Git Product home page Git Product logo

notion-blog-actions's Introduction

notion blog action

将 notion database 中的文章转换为 markdown 文件,提供给 hexo、hugo 等静态博客使用

  • 使用 notion 导出接口,支持图片、表格、callout 等格式
  • 支持迁移图片到置顶文件夹

使用说明

Notion

Github Action

参数说明

inputs:
  token:  # id of input
    description: notion app token,建议最好放到 Action Secret 中
    required: true
  database_id:
    required: true
    description: |
      notion 中的数据库 id
      - 假设你的数据库页面链接是 `https://www.notion.so/you-name/0f3d856498ca4db3b457c5b4eeaxxxxx`
      - 那么 `database_id=0f3d856498ca4db3b457c5b4eeaxxxxx`
  status_name:
    description: notion database 状态字段的字段名,支持自定义
    default: "status"
  status_published:
    description: notion database 文章已发布状态的字段值
    default: "已发布"
  status_unpublish:
    description: |
      notion database 文章待发布状态的字段值
      触发 action 后会自动拉去所有该状态的文章,成功导出之后会把这篇文章的状态修改为上面设置的已发布状态
    default: "待发布"
  migrate_image:
    description: |
      是否迁移图片到 aliyun oss
      注意: 如果不迁移图片默认导出图片链接是 notion 的自带链接,有访问时效
      目前支持迁移图片到 aliyun oss 中
    default: "true"
  output:
    required: false
    description: 输出的文件夹路径
  access_key_id:
    description: aliyun access_key_id
    required: true
  access_key_secret:
    description: aliyun access_key_secret
    required: true
  bucket:
    description: aliyun bucket
    required: true
  area:
    description: "aliyun area: oss-cn-hangzhou"
    required: true
    default: oss-cn-hangzhou
  prefix:
    description: "file dir, e.g. image/"

配置示例

on: [repository_dispatch, watch]

name: notion

jobs:
  notion:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
      with:
        submodules: false

    - uses: mohuishou/notion-blog-actions@main
      with:
        notion_secret: ${{ secrets.NOTION_TOKEN }}
        database_id: "xxx"
        output: "./source/_posts/notion/"
        access_key_id: "${{ secrets.ALI_ID }}"
        access_key_secret: "${{ secrets.ALI_SECRET }}"
        bucket: "xxx"
        area: "${{ inputs.oss_endpoint }}"
        prefix: "image/"

    - name: git setting
      run: |
        git config --global user.email "[email protected]"
        git config --global user.name "mohuishou"

    - name: update blog
      run: |
        git add source
        git commit -m "feat: auto update by notion sync"
        git push

notion-blog-actions's People

Contributors

mohuishou avatar

Stargazers

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

Watchers

 avatar

notion-blog-actions's Issues

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.