resquirrel 0.1.1 → 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 +4 -4
- data/.rubocop.yml +1 -1
- data/lib/main.rb +5 -0
- data/lib/resquirrel/version.rb +1 -1
- data/lib/resquirrel.rb +24 -2
- metadata +4 -4
- data/lib/resquirrel/main.rb +0 -24
- /data/lib/{resquirrel/client → client}/notion.rb +0 -0
- /data/lib/{resquirrel/client → client}/openai.rb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 775bf06ddae912a198a90c60ea25c438fc61b248b6382093900b6726989eeffd
|
|
4
|
+
data.tar.gz: 22f7afd5dc14f52384491a928a3e2f1114d10bc3281270ec541882fd9db2647d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd4b35c5687545c94523f61806bd07f39753fce02fd1bf1b8614cc1643cc01b8be9152b79b3d9f50f867db86c25494088225b07991114a4d3a5891dbb7d2f3f7
|
|
7
|
+
data.tar.gz: 65292664a4fdde9fe000967dbb61817319cdc15e554deb4899a3265d73e6ee104ddd16ef60d771b07f478c500bf21bf30dba8126efbc9426753182d22fb90335
|
data/.rubocop.yml
CHANGED
data/lib/main.rb
ADDED
data/lib/resquirrel/version.rb
CHANGED
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
|
-
|
|
7
|
-
|
|
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.
|
|
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:
|
data/lib/resquirrel/main.rb
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module Resquirrel
|
|
2
|
-
def self.generate_release_note
|
|
3
|
-
openai_client = OpenAiClient.new(ENV["OPENAI_API_KEY"])
|
|
4
|
-
notion_client = NotionClient.new(ENV["NOTION_API_KEY"], ENV["NOTION_DATABASE_ID"])
|
|
5
|
-
logger = Logger.new($stdout)
|
|
6
|
-
|
|
7
|
-
logger.info "Getting PR information..."
|
|
8
|
-
pr_data = JSON.parse(File.read(ENV["GITHUB_EVENT_PATH"]))["pull_request"]
|
|
9
|
-
|
|
10
|
-
title = pr_data["title"]
|
|
11
|
-
body = pr_data["body"]
|
|
12
|
-
|
|
13
|
-
logger.info "Summarizing PR with OpenAI..."
|
|
14
|
-
response = openai_client.summary_pr(title, body)
|
|
15
|
-
|
|
16
|
-
summary = response["choices"].first["message"]["content"]
|
|
17
|
-
url = pr_data["html_url"]
|
|
18
|
-
|
|
19
|
-
logger.info "Updating Notion database..."
|
|
20
|
-
notion_client.create_release_note(summary, url)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
Resquirrel.generate_release_note
|
|
File without changes
|
|
File without changes
|