10
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub ActionsでGitHub Projectsを活用する

Last updated at Posted at 2022-09-01
1 / 12

プロジェクト管理

何使ってる?

  • Jira
  • Backlog
  • Redmine
  • Notion

普段GitHubで開発しているのでGitHub Projectsを使おう


お品書き

  • GitHub Projectsのいいところ :star:
  • Issue templateを活用する :tea:
  • GitHub Projectsに自動で追加する :gear:

GitHub Projectsのいいところ

  • GitHubだけで完結する
    • 無料 :money_mouth:
    • Pull request や Issue の番号でリンク
  • 複数リポジトリをまとめられる
    • iOS/Androidなどまとめて管理 :bridge_at_night:
  • Automated, GitHub Actionsで自動化 :cactus:

Issue templateを活用する


IssueをGitHub Actionsで登録する

  • 1機能の実装が分かれてる
    • Data/Domain/Presentation...
  • 親子タスクの登録
    • Backlog/Feature...

Create an issue

Issue templateを使ってIssueを登録するAction

  • パラメータの受け渡し
  • {{ mustache }}記法で埋め込み
  • Moment.jsによるDateフォーマット

make_issues.yml
name: make issues
on:
  workflow_dispatch:
    inputs:
      feature:
        description: 'feature name'
        required: true
jobs:
  backlog:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: JasonEtco/create-an-issue@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          FEATURE_DATA: ${{ github.event.inputs.feature }} # パラメータの受け渡し
        with:
          filename: .github/ISSUE_TEMPLATE/backlog.md # テンプレートファイルの指定

jobs:
  backlog:
    runs-on: ubuntu-latest
+    outputs:
+      number: ${{ steps.create-backlog.outputs.number }} # 次jobへ引き継ぎ
    steps:
      - uses: actions/checkout@v3
      - uses: JasonEtco/create-an-issue@v2
+        id: create-backlog
        env:
          GITHUB_TOKEN: ${{ secrets.ORGANIZATION_GITHUB_TOKEN }}
+  features:
+    runs-on: ubuntu-latest
+    needs: backlog
+    strategy:
+      matrix:
+        template: [data, domain, presentation] # strategyで複数Issueへの展開
+    steps:
+      - uses: actions/checkout@v3
+      - uses: JasonEtco/create-an-issue@v2
+        env:
+          GITHUB_TOKEN: ${{ secrets.ORGANIZATION_GITHUB_TOKEN }}
+          FEATURE_DATA: ${{ github.event.inputs.feature }}
+          BACKLOG_DATA: ${{ needs.backlog.outputs.number }} # 親Issueへのリンク
+        with:
+          filename: .github/ISSUE_TEMPLATE/${{ matrix.template }}.md

GitHub Projectsに自動で追加する

Add To GitHub projects

IssueやPull Requestを作った時やlabelをつけた時にGitHub Projectsに追加するAction


name: Add To GitHub projects
on:
  issues:
    types:
      - opened # issueを登録した時
jobs:
  add-to-project:
    name: Add issue to project
    runs-on: ubuntu-latest
    steps:
      - uses: actions/add-to-project@v0.3.0
        with:
          # https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
          project-url: https://github.com/orgs/yumemi/projects/1
          # repo and projectのtokenが必要
          github-token: ${{ secrets.ORGANIZATION_GITHUB_TOKEN }}
          # 追加する条件のラベル
          labeled: backlog, enhancement
          label-operator: OR
10
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?