Skip to content

Commit

Permalink
Feature/v0.0.19 alpha 20241103 (#24)
Browse files Browse the repository at this point in the history
* 🔧 プルリクエストのタイトルと説明のフォーマットを改善

* 🔧 action.ymlとgenerate_pr_description.pyに新しい入力パラメータを追加し、プロンプトの指示内容を改善

* 🔧 generate-pr-description.ymlとaction.ymlでOpenAI言語の入力パラメータを追加し、モデルを更新

* 🔧 generate-pr-description.ymlでアクションのバージョンをv0.0.19-alphaに更新
  • Loading branch information
tqer39 authored Nov 3, 2024
1 parent 934cd8f commit 9d57f85
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/generate-pr-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tqer39/[email protected].16-alpha
- uses: tqer39/[email protected].19-alpha
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-model: "gpt-4o"
openai-language: "ja"
15 changes: 10 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ branding:
icon: 'terminal'

inputs:
commit-log-history-limit:
description: 'Commit log history limit'
required: true
default: '70'
github-token:
description: 'GitHub token'
required: true
Expand All @@ -15,6 +19,10 @@ inputs:
description: 'OpenAI API key'
required: true
default: ""
openai-language:
description: 'OpenAI Language'
required: true
default: 'en'
# see https://platform.openai.com/docs/models#continuous-model-upgrades
openai-model:
description: 'OpenAI Model'
Expand All @@ -25,10 +33,6 @@ inputs:
description: 'temperature'
required: true
default: '0.1'
commit-log-history-limit:
description: 'Commit log history limit'
required: true
default: '70'

runs:
using: 'composite'
Expand All @@ -54,10 +58,11 @@ runs:

- name: Generate PR Title and Description
env:
COMMIT_LOG_HISTORY_LIMIT: ${{ inputs.commit-log-history-limit }}
LANGUAGE: ${{ inputs.language }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
OPENAI_MODEL: ${{ inputs.openai-model }}
TEMPERATURE: ${{ inputs.temperature }}
COMMIT_LOG_HISTORY_LIMIT: ${{ inputs.commit-log-history-limit }}
run: |
uv run ${{ github.action_path }}/scripts/generate_pr_description.py > pr_output.txt
cat pr_output.txt
Expand Down
21 changes: 10 additions & 11 deletions scripts/generate_pr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create_prompt(commit_logs: str) -> str:
return f"""
## 指示内容
- 以下のコミットログとファイルの差分を読んで、理解し易いプルリクエストのタイトルと詳細な説明を日本語で作成してください
- 以下のコミットログとファイルの差分を読んで、理解し易いプルリクエストのタイトルと詳細な説明を作成してください
-
- 2行目以降は Markdown 形式で記述してください。
- ファイル名はバッククオートで囲んでください。
Expand All @@ -39,22 +39,20 @@ def create_prompt(commit_logs: str) -> str:
```
- プルリクエストのタイトル
- 1行目に出力してください。Markdown にしないでください。
- タイトルの冒頭には総合的に適した emoji をつけてください。
1. 1行目に出力してください。Markdown にしないでください。
2. タイトルの冒頭には総合的に適した emoji をつけてください。
- プルリクエストの説明
- 2行目以降がプルリクエストの説明です。
- コミットログとファイルを読んで、変更点の概要と技術的な詳細や注意点を記述してください。
- なければ項目ごと出力しない。
- 嘘を書かない。
- 処理内容の図解が必要であれば mermaid.js の記法を使用する。
1. 2行目以降がプルリクエストの説明です。
2. コミットログとファイルを読んで、変更点の概要と技術的な詳細や注意点を記述してください。
1. なければ項目ごと出力しない。
2. 嘘を書かない。
3. 処理内容の図解が必要であれば mermaid.js の記法を使用する。
## コミットログとファイルの差分
{commit_logs}
## 出力形式
プルリクエストのタイトル
## プルリクエストの説明
## 📒 変更点の概要
Expand All @@ -81,6 +79,7 @@ def generate_pr_description(commit_logs: str) -> str:
{"role": "user", "content": prompt},
],
max_tokens=1000,
language=os.getenv("OPENAI_LANGUAGE"),
temperature=float(os.getenv("TEMPERATURE", "0.1")),
)

Expand Down

0 comments on commit 9d57f85

Please sign in to comment.