Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
GitHub Docs

Scheduling issue creation

You can use GitHub Actions to create an issue on a regular basis for things like daily meetings or quarterly reviews.

Introduction

This tutorial demonstrates how to use the GitHub CLI to create an issue on a regular basis. For example, you can create an issue each week to use as the agenda for a team meeting. For more information about GitHub CLI, seeUsing GitHub CLI in workflows.

In the tutorial, you will first make a workflow file that uses the GitHub CLI. Then, you will customize the workflow to suit your needs.

Creating the workflow

  1. Choose a repository where you want to apply this project management workflow. You can use an existing repository that you have write access to, or you can create a new repository. For more information about creating a repository, seeCreating a new repository.

  2. In your repository, create a file called.github/workflows/YOUR_WORKFLOW.yml, replacingYOUR_WORKFLOW with a name of your choice. This is a workflow file. For more information about creating new files on GitHub, seeCreating new files.

  3. Copy the following YAML contents into your workflow file.

    YAML
    name:WeeklyTeamSyncon:schedule:-cron:2007**1jobs:create_issue:name:Createteamsyncissueruns-on:ubuntu-latestpermissions:issues:writesteps:-name:Createteamsyncissuerun:|          if [[ $CLOSE_PREVIOUS == true ]]; then            previous_issue_number=$(gh issue list \              --label "$LABELS" \              --json number \              --jq '.[0].number')            if [[ -n $previous_issue_number ]]; then              gh issue close "$previous_issue_number"              gh issue unpin "$previous_issue_number"            fi          fi          new_issue_url=$(gh issue create \            --title "$TITLE" \            --assignee "$ASSIGNEES" \            --label "$LABELS" \            --body "$BODY")          if [[ $PINNED == true ]]; then            gh issue pin "$new_issue_url"          fienv:GH_TOKEN:${{secrets.GITHUB_TOKEN}}GH_REPO:${{github.repository}}TITLE:TeamsyncASSIGNEES:monalisa,doctocat,hubotLABELS:weeklysync,docs-teamBODY:|            ### Agenda- [ ]Starttherecording- [ ]Check-ins- [ ]Discussionpoints- [ ]Posttherecording### Discussion PointsAddthingstodiscussbelow- [Workthisweek](https://github.com/orgs/github/projects/3)PINNED:falseCLOSE_PREVIOUS:false
  4. Customize the parameters in your workflow file:

    • Change the value foron.schedule to dictate when you want this workflow to run. In the example above, the workflow will run every Monday at 7:20 UTC. For more information about scheduled workflows, seeEvents that trigger workflows.
    • Change the value forASSIGNEES to the list of GitHub usernames that you want to assign to the issue.
    • Change the value forLABELS to the list of labels that you want to apply to the issue.
    • Change the value forTITLE to the title that you want the issue to have.
    • Change the value forBODY to the text that you want in the issue body. The| character allows you to use a multi-line value for this parameter.
    • If you want to pin this issue in your repository, setPINNED totrue. For more information about pinned issues, seePinning an issue to your repository.
    • If you want to close the previous issue generated by this workflow each time a new issue is created, setCLOSE_PREVIOUS totrue. The workflow will close the most recent issue that has the labels defined in thelabels field. To avoid closing the wrong issue, use a unique label or combination of labels.
  5. Commit your workflow file to the default branch of your repository. For more information, seeCreating new files.

Expected results

Based on theschedule parameter (for example, every Monday at 7:20 UTC), your workflow will create a new issue with the assignees, labels, title, and body that you specified. If you setPINNED totrue, the workflow will pin the issue to your repository. If you setCLOSE_PREVIOUS to true, the workflow will close the most recent issue with matching labels.

Note

Theschedule event can be delayed during periods of high loads of GitHub Actions workflow runs. High load times include the start of every hour. If the load is sufficiently high enough, some queued jobs may be dropped. To decrease the chance of delay, schedule your workflow to run at a different time of the hour.

You can view the history of your workflow runs to see this workflow run periodically. For more information, seeViewing workflow run history.

Next steps


[8]ページ先頭

©2009-2025 Movatter.jp