resquirrel 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1b67d88a6d2613d99f17da16dbd88b207d4f8d73f53ac89ebc4e4baa9d97ece
4
- data.tar.gz: 01c194ab3ac13bd585480877360bcdf595d3bc8694a2d6d1e81806df53800ada
3
+ metadata.gz: 775bf06ddae912a198a90c60ea25c438fc61b248b6382093900b6726989eeffd
4
+ data.tar.gz: 22f7afd5dc14f52384491a928a3e2f1114d10bc3281270ec541882fd9db2647d
5
5
  SHA512:
6
- metadata.gz: 3b73fe4ea5c9adf48c4db5b0a8f0c8a13f08859f454bb302bfdb69fece539799adab9e7175748110385ed026bc5f69fbb40ae898f3429fb8c265592349cc300b
7
- data.tar.gz: f26a0c8c04e737cc5bc1ecd37ad870984f1859166b7de1232fa7e03b6cb5af8471fbfea839091cc1db7bb8d89736fe44252cc41123b27fd94053260b590a09bd
6
+ metadata.gz: bd4b35c5687545c94523f61806bd07f39753fce02fd1bf1b8614cc1643cc01b8be9152b79b3d9f50f867db86c25494088225b07991114a4d3a5891dbb7d2f3f7
7
+ data.tar.gz: 65292664a4fdde9fe000967dbb61817319cdc15e554deb4899a3265d73e6ee104ddd16ef60d771b07f478c500bf21bf30dba8126efbc9426753182d22fb90335
data/.rubocop.yml CHANGED
@@ -16,7 +16,7 @@ Metrics/MethodLength:
16
16
  Max: 30
17
17
 
18
18
  Metrics/AbcSize:
19
- Max: 20
19
+ Max: 30
20
20
 
21
21
  Style/Documentation:
22
22
  Enabled: false
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ gem install resquirrel
37
37
  2. データベースには、以下のプロパティを用意します。
38
38
  - `changes` : リリースノートのタイトル(DBを作成するとデフォルトで用意されています。)
39
39
  - `URL` : リリースノートのリンク
40
- 3. 作成したDBのURLをコピーして、https://www.notion.so/[この部分]?v=hogehoge の文字列を、リリースノートを作成したいリポジトリのrepository secretsに登録します。`NOTION_DATABASE_ID`という名前で登録してください。
40
+ 3. 作成したDBのURLをコピーして、`https://www.notion.so/[この部分]?v=hogehoge` の文字列を、リリースノートを作成したいリポジトリのrepository secretsに登録します。`NOTION_DATABASE_ID`という名前で登録してください。
41
41
 
42
42
  ### Open AI APIの用意
43
43
  1. Open AI APIを使えるようにするためのAPIキーを取得します。
data/lib/main.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "resquirrel"
4
+
5
+ Resquirrel.generate_release_note
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Resquirrel
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/resquirrel.rb CHANGED
@@ -1,8 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "resquirrel/version"
4
+ require_relative "client/openai"
5
+ require_relative "client/notion"
6
+ require "json"
7
+ require "logger"
4
8
 
5
9
  module Resquirrel
6
- class Error < StandardError; end
7
- # Your code goes here...
10
+ def self.generate_release_note
11
+ openai_client = OpenAiClient.new(ENV["OPENAI_API_KEY"])
12
+ notion_client = NotionClient.new(ENV["NOTION_API_KEY"], ENV["NOTION_DATABASE_ID"])
13
+ logger = Logger.new($stdout)
14
+
15
+ logger.info "Getting PR information..."
16
+ pr_data = JSON.parse(File.read(ENV["GITHUB_EVENT_PATH"]))["pull_request"]
17
+
18
+ title = pr_data["title"]
19
+ body = pr_data["body"]
20
+
21
+ logger.info "Summarizing PR with OpenAI..."
22
+ response = openai_client.summary_pr(title, body)
23
+
24
+ summary = response["choices"].first["message"]["content"]
25
+ url = pr_data["html_url"]
26
+
27
+ logger.info "Updating Notion database..."
28
+ notion_client.create_release_note(summary, url)
29
+ end
8
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resquirrel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuki-snow1823
@@ -24,10 +24,10 @@ files:
24
24
  - LICENSE.txt
25
25
  - README.md
26
26
  - Rakefile
27
+ - lib/client/notion.rb
28
+ - lib/client/openai.rb
29
+ - lib/main.rb
27
30
  - lib/resquirrel.rb
28
- - lib/resquirrel/client/notion.rb
29
- - lib/resquirrel/client/openai.rb
30
- - lib/resquirrel/main.rb
31
31
  - lib/resquirrel/version.rb
32
32
  homepage: https://github.com/yuki-snow1823/resquirrel
33
33
  licenses:
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "logger"
4
- require "json"
5
- require_relative "client/notion"
6
- require_relative "client/openai"
7
-
8
- class Resquirrel
9
- def initialize
10
- @openai_client = OpenAiClient.new(ENV["OPENAI_API_KEY"])
11
- @notion_client = NotionClient.new(ENV["NOTION_API_KEY"], ENV["NOTION_DATABASE_ID"])
12
- end
13
-
14
- def generate_release_note
15
- logger = Logger.new($stdout)
16
-
17
- logger.info "Getting PR information..."
18
- pr_data = JSON.parse(File.read(ENV["GITHUB_EVENT_PATH"]))["pull_request"]
19
-
20
- title = pr_data["title"]
21
- body = pr_data["body"]
22
-
23
- logger.info "Summarizing PR with OpenAI..."
24
- response = @openai_client.summary_pr(title, body)
25
-
26
- summary = response["choices"].first["message"]["content"]
27
- url = pr_data["html_url"]
28
-
29
- logger.info "Updating Notion database..."
30
- @notion_client.create_release_note(summary, url)
31
- end
32
- end
33
-
34
- resquirrel = Resquirrel.new
35
- resquirrel.generate_release_note
File without changes
File without changes