4
1

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を用いて定期的にIssueを作成する方法

Last updated at Posted at 2021-02-11

これは何

  • GitHub Actionsで Issue を定期的に作成するための YML ファイルの定義を記載する
    • 定期的に手動で Issue を作成する場合など少しだけ手間を減らすことが出来る :muscle:

使用する Actions

設定

  • GitHub レポジトリはすでに作成している前提で記載します

ディレクトリの作成

  • GitHub Actions の設定ファイルは .github フォルダ以下に記載します
cd path/to/repository
mkdir -p .github/workflows

YML ファイルの作成

touch .github/workflows/create_issue.yml

設定を記述

  • 今回は月曜日の 09:00(JST)に定期的に Issue を作るように設定してみる
    • GitHub Actions の cron 定義はこちらを確認ください :pray:
name: Create an issue on Monday 09:00 (JST)

on:
  schedule:
    - cron: '0 0 * * 1'

jobs:
  create_issues:
    runs-on: ubuntu-latest
    steps:
      - name: Get today and tomorrow date
        id: date
        run: |
          echo "::set-output name=tomorrow::$(date "+%Y/%m/%d" -d "1 day")"
      - name: Create an issue
        uses: actions-ecosystem/action-create-issue@v1
        with:
          github_token: ${{ secrets.github_token }}
          title: '【${{ steps.date.outputs.tomorrow }}】定期タスク'
          body: |
            ## To do
            + [ ] 準備

          labels: |
            Routine

記述がおわったら master(main)ブランチに commit & push しておきましょう。

References

4
1
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
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?