Skip to content

Commit 505b629

Browse files
committed
🔄 ラベル作成処理をGitHub Labelerに置き換え
1 parent 33389f2 commit 505b629

4 files changed

Lines changed: 47 additions & 35 deletions

File tree

.github/labels.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
- name: ":bug: バグ"
2+
color: "d73a4a"
3+
description: "バグ報告やバグ修正に関連するイシューやプルリクエストに適用します。"
4+
- name: ":bulb: 改善or提案"
5+
color: "a2eeef"
6+
description: "プロジェクトの改善点や提案、一般的なフィードバックに使用します。"
7+
- name: ":hammer: リファクタリング"
8+
color: "2CC86F"
9+
description: "コードの可読性や構造の改善、保守性の向上を目的とした変更に適用します。"
10+
- name: ":lock: セキュリティ"
11+
color: "FBCA04"
12+
description: "セキュリティ関連の問題や改善提案に使用します。脆弱性の報告やセキュリティ機能の追加など。"
13+
- name: ":memo: ドキュメンテーション"
14+
color: "0075ca"
15+
description: "ドキュメント関連の改善や更新、問題報告に使用します。"
16+
- name: ":no_entry_sign: 取り消し・無効"
17+
color: "cfd3d7"
18+
description: "プロジェクトの範囲外、または不適切な内容のイシューやプルリクエストに使用します。"
19+
- name: ":question: 質問"
20+
color: "FCF867"
21+
description: "追加の情報や明確化が必要なイシューやプルリクエストに使用します。"
22+
- name: ":repeat: ヨコ展開・既存イシュー"
23+
color: "267C33"
24+
description: "既に報告されているイシューやプルリクエストと重複する内容に使用します。"
25+
- name: ":rocket: パフォーマンス"
26+
color: "43B5C9"
27+
description: "システムやアプリケーションのパフォーマンス改善に関連するイシューやプルリクエストに使用します。"
28+
- name: ":sparkles: 新機能"
29+
color: "6E1C51"
30+
description: "新しい機能の提案や要求に適用します。新規アイデアや機能拡張に関するイシューやプルリクエスト。"
31+
- name: ":wastebasket: 残課題・作業不足"
32+
color: "ffffff"
33+
description: "現時点で対応する予定のないイシューやプルリクエストに適用します。"

.github/workflows/create-issue.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: create template issue
1+
name: Create Template Issue
22

33
# トリガー設定: pushイベント時にこのワークフローを実行
44
on:

.github/workflows/setup-labels.yml

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
name: Setup Repository Labels
22

33
# このワークフローは、mainまたはmasterブランチへの最初のpushイベントでトリガーされます。
4-
on:
5-
push:
6-
branches:
7-
- main
8-
- master
4+
# トリガー設定: pushイベント時にこのワークフローを実行
5+
on:
6+
- push
97

108
permissions:
9+
contents: read
1110
issues: write
12-
pull-requests: none
1311

1412
jobs:
1513
setup-labels:
@@ -25,34 +23,14 @@ jobs:
2523
- name: Get parent hash
2624
run: echo "PARENT_COUNT=$(git rev-parse HEAD^@ | wc -l)" >> $GITHUB_ENV
2725

28-
# ステップ3: テンプレートからイシューを作成
29-
# 初回コミット(親コミットがない場合)のみイシューを作成
30-
- name: Create template issue
26+
# ステップ3: ラベルの初期設定
27+
# 初回コミット(親コミットがない場合)のみラベルの初期設定
28+
- name: GitHub Labeler
3129
if: env.PARENT_COUNT == 0
32-
uses: actions/github-script@v5
33-
env:
34-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHubトークンの使用
30+
uses: crazy-max/ghaction-github-labeler@v5.0.0
3531
with:
36-
script: |
37-
// 既存のラベルを全て取得し削除します。
38-
const labels = await github.rest.issues.listLabelsForRepo({
39-
owner: context.repo.owner,
40-
repo: context.repo.repo
41-
});
42-
for (const label of labels.data) {
43-
await github.rest.issues.deleteLabel({
44-
owner: context.repo.owner,
45-
repo: context.repo.repo,
46-
name: label.name
47-
});
48-
}
49-
50-
// 新しいラベルを作成します。
51-
await github.rest.issues.createLabel({
52-
owner: context.repo.owner,
53-
repo: context.repo.repo,
54-
name: 'New Label',
55-
color: '008672',
56-
description: 'Label for new issues and PRs'
57-
});
5832
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
yaml-file: .github/labels.yml
34+
skip-delete: false # trueのとき、定義ファイルに記載の無いラベルの削除を行わない
35+
dry-run: false # trueの場合は、結果のみ表示で反映しない
36+

.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"ms-vscode.PowerShell",
1212
"ms-azuretools.vscode-docker",
1313
"bierner.markdown-checkbox",
14+
"github.vscode-github-actions"
1415
],
1516
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
1617
"unwantedRecommendations": [

0 commit comments

Comments
 (0)