iTranslated by AI
Automatically generate GitHub issues from templates with GitHub Actions
Introduction
I usually create an issue every day in a private GitHub repository and write things like daily reports and TODO lists there.
Since the overall structure of the issues is always the same, I created a GitHub ISSUE_TEMPLATE and have been manually creating an issue using this template every day until now.
The specific steps for "manually creating an issue from a template" were as follows:
- Go to the GitHub issue page
- Select "New Issue"
- Select "Get started" for the target template
- Enter the date in the title
- Select "Submit new issue"
Well, it's a task that takes about a minute to complete, but since it feels like a waste of time to spend a minute on the same task every day, I automated it using GitHub Actions. In this article, I will introduce how to do it.
Method
In conclusion, I was able to achieve this easily by using JasonEtco/create-an-issue.
The usage is described in the README, so looking at that might be enough, but I will introduce how to use JasonEtco/create-an-issue for this specific use case.
Creating the Template
Create a markdown file like the following in .github/ISSUE_TEMPLATE/daily_report.md.
---
name: Daily Report
about: Template for daily reports
title: "{{ date | date('YYYY/MM/DD') }}"
---
## TODO
- [ ] hoge
## Reflection
Creating the GitHub Actions Workflow
Create a file like the following in .github/workflows/create_daily_report.yml.
name: Create Daily Report
on:
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
create_issue:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/ISSUE_TEMPLATE/daily_report.md
That's it for the preparation.
How to Run
When you select "Run workflow" for "Create Daily Report" from the GitHub Actions tab, the workflow will be executed, and an issue like the one below will be automatically generated.

Additional Notes
If you want to run it periodically, you can achieve this by setting a schedule.
# To run every day at 6:00 AM JST
on:
schedule:
- cron: '0 21 * * *'
Also, it seems you can reference environment variables and variables listed in toolscontext within the template.
# Reference environment variables
{{ env.GITHUB_ACTOR }}
# Reference toolscontext
{{ repo.owner }}
Discussion