Create an issue
ActionsTags
(1)A GitHub Action that creates a new issue using a template file.
This GitHub Action creates a new issue based on an issue template file. Here's an example workflow that creates a new issue any time you push a commit:
# .github/workflows/issue-on-push.yml
on: [push]
name: Create an issue on push
permissions:
contents: read
issues: write
jobs:
stuff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}This reads from the .github/ISSUE_TEMPLATE.md file. This file should have front matter to help construct the new issue:
---
title: Someone just pushed
assignees: JasonEtco, matchai
labels: bug, enhancement
---
Someone just pushed, oh no! Here's who did it: {{ payload.sender.login }}.You'll notice that the above example has some {{ mustache }} variables. Your issue templates have access to several things about the event that triggered the action. Besides issue and pullRequest, you have access to all the template variables on this list. You can also use environment variables:
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADJECTIVE: greatEnvironment variables are pretty {{ env.ADJECTIVE }}, right?Note that you can only assign people matching given conditions.
Additionally, you can use the date filter and variable to show some information about when this issue was created:
---
title: Weekly Radar {{ date | date('dddd, MMMM Do') }}
---
What's everyone up to this week?This example will create a new issue with a title like Weekly Radar Saturday, November 10th. You can pass any valid Moment.js formatting string to the filter.
Don't want to use .github/ISSUE_TEMPLATE.md? You can pass an input pointing the action to a different template:
steps:
- uses: actions/checkout@v3
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/some-other-template.mdWant to use Action logic to determine who to assign the issue to, to assign a milestone or to update an existing issue with the same title? You can pass an input containing the following options:
steps:
- uses: actions/checkout@v3
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
assignees: JasonEtco, octocat
milestone: 1
update_existing: true
search_existing: all- The
assigneesandmilestonespeak for themselves. - The
update_existingparam can be passed and set totruewhen you want to update an open issue with the exact same title when it exists andfalseif you don't want to create a new issue, but skip updating an existing one. - The
search_existingparam lets you specify whether to searchopen,closed, orallexisting issues for duplicates (default isopen).
If you need the number or URL of the issue that was created for another Action, you can use the number or url outputs, respectively. For example:
steps:
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: create-issue
- run: 'echo Created issue number ${{ steps.create-issue.outputs.number }}'
- run: 'echo Created ${{ steps.create-issue.outputs.url }}'Create an issue is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.