Skip to content

Commit

Permalink
🚀 ワークフローとドキュメントの改善および新機能の追加 (#28)
Browse files Browse the repository at this point in the history
* 🎉 新しいワークフローを追加: 毎年1月1日にライセンス年を更新する自動化

* 📄 READMEにライセンス情報を追加

* 📄 READMEに貢献方法のセクションを追加

* 📄 markdownlintの設定ファイルを追加し、pre-commitフックにmarkdownlintを統合

* READMEと日本語版READMEにヘッダー画像とタイトルを追加し、説明文を強調表示。アクションのバージョンをv1.0.0に更新。

* READMEのヘッダー画像のパスを修正

* READMEの使用例の名前を「OpenAI PR Description Generator」から「OpenAI Generate PR Title and Description」に変更

* アクションのブランディングの色を青から緑に変更し、アイコンをターミナルからコードに更新

* pipのアップグレードとuvのセットアップ手順をワークフローに追加

* コミットログの履歴制限を70に設定
  • Loading branch information
tqer39 authored Nov 4, 2024
1 parent 32b7975 commit beec413
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 10 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/generate-pr-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,26 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5

- name: pip upgrade
run: python -m pip install --upgrade pip

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.26"

- name: Setup uv
run: |
uv venv
source .venv/bin/activate
uv sync --no-dev
shell: bash

- name: Generate PR Title and Description
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_MODEL: "gpt-4o"
COMMIT_LOG_HISTORY_LIMIT: 70
run: |
uv run scripts/generate_pr_description.py > pr_output.txt
cat pr_output.txt
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/update-license-year.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Update License Year

on:
schedule:
- cron: '0 0 1 1 *' # 毎年1月1日に実行
workflow_dispatch:

jobs:
commit-changes:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write # git push するために必要
steps:
- uses: actions/checkout@v4

- name: Generate GitHub App Token
id: app_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.GHA_APP_ID }}
private-key: ${{ secrets.GHA_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- uses: tqer39/[email protected]
with:
github-token: ${{ steps.app_token.outputs.token }}
19 changes: 19 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"MD013": false,
"MD024": false,
"MD030": false,
"MD033": {
"allowed_elements": [
"a",
"details",
"h1",
"i",
"img",
"p",
"span",
"summary"
]
},
"MD041": false,
"default": true
}
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ repos:
hooks:
- id: cspell

# see: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
hooks:
- id: markdownlint

- repo: local
hooks:
- id: textlint
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Generate Pull Request Title and Description
<p align="center">
<a href="">
<img src="./docs/header.jpg" alt="header" width="100%">
</a>
<h1 align="center">OpenAI Generate PR Title and Description</h1>
</p>

This workflow uses an article generation model by OpenAI to generate the title and body of a pull request.
<p align="center">
<i>This workflow uses an article generation model by OpenAI to generate the title and body of a pull request.</i>

## Usage

```yaml
name: OpenAI PR Description Generator
name: OpenAI Generate PR Title and Description

on:
pull_request:
Expand All @@ -25,7 +31,7 @@ jobs:
if: contains(github.event.pull_request.user.login, 'renovate') == false
steps:
- uses: actions/checkout@v4
- uses: tqer39/generate-pr-description-action@v0.0.21-alpha
- uses: tqer39/generate-pr-description-action@v1.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
open-api-key: ${{ secrets.OPENAI_API_KEY }}
Expand All @@ -40,3 +46,11 @@ jobs:
### `open-api-key`

**Required** OpenAI API key. Specify `${{ secrets.OPENAI_API_KEY }}`.

## Contribution

If you find any issues or have improvements, please create an Issue or submit a Pull Request.

## License

This action is released under the MIT license. For more information, see [LICENSE](LICENSE).
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: 'Generate Pull Request Title and Description'
description: 'Generate Pull Request Title and Description'
author: Takeru O'oyama @tqer39
branding:
color: 'blue'
icon: 'terminal'
color: 'green'
icon: 'code'

inputs:
commit-log-history-limit:
Expand Down
23 changes: 19 additions & 4 deletions docs/README.ja.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Generate Pull Request Title and Description
<p align="center">
<a href="">
<img src="./header.jpg" alt="header" width="100%">
</a>
<h1 align="center">OpenAI Generate PR Title and Description</h1>
</p>

このワークフローでは OpenAI による文章生成モデルを使って、プルリクエストのタイトルと本文を生成します。
<p align="center">
<i>このワークフローでは OpenAI による文章生成モデルを使って、プルリクエストのタイトルと本文を生成します。</i>
</p>

## 使い方

```yaml
name: OpenAI PR Description Generator
name: OpenAI Generate PR Title and Description

on:
pull_request:
Expand All @@ -24,7 +31,7 @@ jobs:
if: contains(github.event.pull_request.user.login, 'renovate') == false
steps:
- uses: actions/checkout@v4
- uses: tqer39/generate-pr-description-action@v0.0.21-alpha
- uses: tqer39/generate-pr-description-action@v1.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
open-api-key: ${{ secrets.OPENAI_API_KEY }}
Expand All @@ -39,3 +46,11 @@ jobs:
### `open-api-key`

**必須** OpenAI API キー。`${{ secrets.OPENAI_API_KEY }}` を指定します。

## 貢献方法

問題や課題が発見されたら Issue を作成するか Pull Request を作成していただけると幸いです。

## ライセンス

このアクションは MIT ライセンスのもとで公開されています。詳細については [LICENSE](LICENSE) を参照してください。
Binary file added docs/header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit beec413

Please sign in to comment.