Skip to content

Commit 51ffe6e

Browse files
authored
Merge pull request #123 from yumechi/feature/blog-issue-workflow
feat: GitHub issueからブログ記事を作成するワークフローを追加
2 parents 8832eae + 163bdd9 commit 51ffe6e

3 files changed

Lines changed: 188 additions & 0 deletions

File tree

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
name: process-blog-issue
3+
description: GitHub issueからブログ記事を作成しPRを作成します
4+
---
5+
6+
# Process Blog Issue
7+
8+
GitHub issueに記載されたブログ記事リクエストを処理し、記事を作成してPRを作成します。
9+
10+
## 実行手順
11+
12+
### 1. blog-request issueを取得
13+
14+
以下のコマンドで `blog-request` ラベルが付いたオープンなissueを全て取得します:
15+
16+
```bash
17+
gh issue list --label blog-request --state open --json number,title,body
18+
```
19+
20+
取得したissueが0件の場合は「処理対象のissueがありません」と報告して終了します。
21+
22+
**オプション**: ユーザーが特定のissue番号を指定した場合は、そのissueのみを処理します。
23+
24+
### 2. 各issueを処理
25+
26+
取得した各issueに対して、以下の処理を順番に実行します:
27+
28+
#### 2.1 issueの内容をパース
29+
30+
issueテンプレートから以下のフィールドを抽出します:
31+
32+
- **ブログ記事のタイトル**: `### ブログ記事のタイトル` セクションの内容
33+
- **slug**: `### slug` セクションの内容
34+
- **タグ**: `### タグ` セクションの内容(カンマ区切り)
35+
- **資料のタイトル**: `### 資料のタイトル` セクションの内容
36+
- **資料のURL**: `### 資料のURL` セクションの内容
37+
- **感想・学び**: `### 感想・学び` セクションの内容
38+
39+
#### 2.2 ブランチを作成
40+
41+
mainブランチから、issue番号を含むブランチを作成します:
42+
43+
```bash
44+
git checkout main
45+
git pull origin main
46+
git checkout -b blog/issue-<issue番号>
47+
```
48+
49+
#### 2.3 ブログ記事を作成
50+
51+
以下の形式でファイルを作成します:
52+
53+
- **ファイルパス**: `blog/YYYY/MM-DD-<slug>/index.md`
54+
- `YYYY` は現在の年
55+
- `MM-DD` は現在の月日
56+
- `slug` はissueから取得した値
57+
58+
**ファイル内容**:
59+
60+
```markdown
61+
---
62+
slug: /<slug>
63+
title: <ブログ記事のタイトル>
64+
authors: yumechi
65+
tags: [<タグをカンマ区切りで>]
66+
---
67+
68+
<資料の簡単な紹介文を1-2文で生成>
69+
70+
<!-- truncate -->
71+
72+
## 資料リンク
73+
74+
- [<資料のタイトル>](<資料のURL>)
75+
76+
## 感想・学び
77+
78+
<感想・学びの内容>
79+
```
80+
81+
#### 2.4 コミット & プッシュ
82+
83+
```bash
84+
git add blog/
85+
git commit -m "feat: <ブログ記事のタイトル>の記事を追加
86+
87+
Closes #<issue番号>"
88+
git push -u origin blog/issue-<issue番号>
89+
```
90+
91+
#### 2.5 PRを作成
92+
93+
```bash
94+
gh pr create --title "feat: <ブログ記事のタイトル>" --body "## Summary
95+
96+
- issueに基づいてブログ記事を作成しました
97+
98+
## Related Issue
99+
100+
Closes #<issue番号>
101+
102+
---
103+
Generated with Claude Code"
104+
```
105+
106+
### 3. 完了報告
107+
108+
全てのissueの処理が完了したら、ユーザーに以下を報告します:
109+
110+
- 処理したissueの数
111+
- 各issueに対して作成したPRのURL一覧
112+
- エラーがあった場合はその内容
113+
114+
## 注意事項
115+
116+
- slugは英数字とハイフンのみを使用(issueから取得した値をそのまま使用)
117+
- タグが空の場合は空配列 `[]` を設定
118+
- 感想が長い場合は適切に段落分けする
119+
- issueの内容が不足している場合はスキップしてユーザーに報告する
120+
- 複数のissueを処理する場合、各issueごとに別々のブランチとPRを作成する
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: ブログ記事リクエスト
2+
description: 読んだ記事やスライドの感想をブログ記事として作成するリクエスト
3+
title: "[Blog] "
4+
labels: ["blog-request"]
5+
body:
6+
- type: input
7+
id: blog-title
8+
attributes:
9+
label: ブログ記事のタイトル
10+
description: ブログページに表示されるタイトル
11+
placeholder: "例: React Hooksの基礎を学んだ"
12+
validations:
13+
required: true
14+
15+
- type: input
16+
id: slug
17+
attributes:
18+
label: slug
19+
description: URLに使用される識別子(英数字とハイフンのみ)
20+
placeholder: "例: react-hooks-basics"
21+
validations:
22+
required: true
23+
24+
- type: input
25+
id: tags
26+
attributes:
27+
label: タグ
28+
description: 記事のタグ(カンマ区切り)
29+
placeholder: "例: React, JavaScript, 学習"
30+
validations:
31+
required: false
32+
33+
- type: input
34+
id: source-title
35+
attributes:
36+
label: 資料のタイトル
37+
description: 読んだ記事/スライドのタイトル
38+
placeholder: "例: React Hooks入門ガイド"
39+
validations:
40+
required: true
41+
42+
- type: input
43+
id: source-url
44+
attributes:
45+
label: 資料のURL
46+
description: 資料へのリンク
47+
placeholder: "https://example.com/article"
48+
validations:
49+
required: true
50+
51+
- type: textarea
52+
id: thoughts
53+
attributes:
54+
label: 感想・学び
55+
description: 感想や学んだことを記載してください
56+
placeholder: |
57+
この記事を読んで学んだこと、感想、気づきなどを書いてください。
58+
validations:
59+
required: true

CLAUDE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,12 @@ yumechi の個人ホームページです。プロフィールや読んだ記事
5757
プロジェクトをビルドしてローカルサーバーで確認する。
5858

5959
**使い方**: `/build-test` を実行
60+
61+
### process-blog-issue
62+
63+
GitHub issueに記載されたブログ記事リクエストを処理し、記事を作成してPRを作成する。
64+
65+
**使い方**: `/process-blog-issue` を実行
66+
- `blog-request` ラベルが付いた全てのオープンissueを自動的に処理
67+
- 各issueごとに別々のブランチとPRを作成
68+
- 特定のissue番号を指定した場合はそのissueのみ処理

0 commit comments

Comments
 (0)