tenhobi / create-an-issue

A GitHub Action for creating a new issue from a template file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create an Issue Action

A GitHub Action that creates a new issue using a template file.

GitHub Actions status Codecov

Usage

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
jobs:
  stuff:
    steps:
      - uses: JasonEtco/create-an-issue@master
        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 everything about the event that triggered the action. Here is a list of all of the available template variables.

Dates

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.

Custom templates

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@master
  - uses: JasonEtco/create-an-issue@master
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    with:
      filename: .github/some-other-template.md

Assignee input

Want to use Action logic to determine who to assign the issue to? You can pass an input containing the assignee list:

steps:
  - uses: actions/checkout@master
  - uses: JasonEtco/create-an-issue@master
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    with:
      assignees: JasonEtco, octocat

Outputs

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@master
    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 }}'

About

A GitHub Action for creating a new issue from a template file.

License:MIT License


Languages

Language:JavaScript 92.6%Language:Dockerfile 7.4%