Project

resquirrel

0.0
The project is in a healthy, maintained state
RubyGems that automatically create release notes for Notion DB using Open AI API when PR merge.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Resquirrel

RubyGems that automatically create release notes for Notion DB using Open AI API.

Installation

Add this line to your application's Gemfile:

gem 'resquirrel'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install resquirrel

Usage(日本語)

NotionのAPIキーの用意

  1. まずは、NotionのAPIを使えるようにするためのトークンを取得します。
  2. Notionの開発者ページにアクセスします。
  3. New integrationをクリックして、作成したトークンをリリースノートを作成したいリポジトリのrepository secretsに登録します。NOTION_API_KEYという名前で登録してください。

Notionのデータベースの用意

  1. Notionにリリースノートを作成するためのFull Pageのデータベースを作成します。
  2. データベースには、以下のプロパティを用意します。
    • changes : リリースノートのタイトル(DBを作成するとデフォルトで用意されています。)
    • URL : リリースノートのリンク
  3. 作成したDBのURLをコピーして、https://www.notion.so/[この部分]?v=hogehoge の文字列を、リリースノートを作成したいリポジトリのrepository secretsに登録します。NOTION_DATABASE_IDという名前で登録してください。

Open AI APIの用意

  1. Open AI APIを使えるようにするためのAPIキーを取得します。
  2. Open AIの開発者ページにアクセスします。
  3. Create API Keyをクリックして、作成したAPIキーをリリースノートを作成したいリポジトリのrepository secretsに登録します。OPENAI_API_KEYという名前で登録してください。
    • 制限に関しては、ModelsのRead、Model CapabilitiesのWriteが必要です。

実行方法

sample: .github/workflows/create_release_notes.yml のようなCIで実行するファイルを作成します。

name: create release notes

on:
  pull_request:
    types:
      - closed

jobs:
  create_release_notes:
    if: ${{ github.event.pull_request.merged }}
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: '3.3'

    - name: Install dependencies
      run: |
        bundle install

    - name: Run script
      run: ruby lib/resquirrel.rb
      env:
        GITHUB_EVENT_PATH: ${{ github.event_path }}
        OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
        NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
require 'resquirrel'

Resquirrel.generate_release_note

それぞれのenvは必須です。

Usage(English)

Preparing Notion's API key

  1. first, you will need to obtain a token to be able to use Notion's API. 2.
  2. go to Notion's developer page.
  3. click New integration and register the token you have created in the repository secrets of the repository for which you want to create release notes. The name shold be set NOTION_API_KEY.

Preparing Notion's database

  1. Create a Full Page database in Notion to create release notes.
  2. Prepare the following properties in the database.
    • changes : Title of the release note (this is provided by default when you create a DB.)
    • URL : Link to the release note
  3. Copy the URL of the created DB and register the string https://www.notion.so/[this part]?v=hogehoge in the repository secrets of the repository where you want to create the release notes. The name should be set to NOTION_DATABASE_ID.

Preparing Open AI API

  1. Obtain an API key to use the Open AI API.
  2. Go to the Open AI developer page.
  3. Click Create API Key and register the created API key in the repository secrets of the repository where you want to create the release notes. The name should be set to OPENAI_API_KEY.
    • The required permissions are Models Read and Model Capabilities Write.

How to run

sample: Create a file to run the script in CI, such as .github/workflows/create_release_notes.yml.

name: create release notes

on:
  pull_request:
    types:
      - closed

jobs:
  create_release_notes:
    if: ${{ github.event.pull_request.merged }}
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: '3.3'

    - name: Install dependencies
      run: |
        bundle install

    - name: Run script
      run: ruby lib/resquirrel.rb
      env:
        GITHUB_EVENT_PATH: ${{ github.event_path }}
        OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
        NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
require 'resquirrel'

Resquirrel.generate_release_note

Each env is required.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yuki-snow1823/resquirrel This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Resquirrel project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.