There can be cases where it makes sense to create issues in MantisHub from GitHub actions. For example:
- After creating a new release, create a work item for follow-up steps.
- When build breaks, open a work item to fix it.
- Certain workflow that is manually creating and includes some manual work to be done as a follow-up.
To use this action in your GitHub workflow, add the following step to your workflow file:
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
repository: mantishub/action-create-issue
- name: Create an Issue
id: create-issue
uses: mantishub/action-create-issue@v1
with:
url: https://example.mantishub.io
api-key: ${{ secrets.API_KEY }}
project: 'MyProject'
summary: "Build is broken"
description: |
The build is broken.
Error message is "xxxxxxxx"
category: 'General'
This workflow demonstrates how to use the action-create-issue
in a GitHub Actions workflow to create a new issue in a MantisHub project. The workflow checks out the code, runs the custom action, and retrieves the new issue ID.
In GitHub Actions, you can use the id field to assign a unique identifier to a step within a job. This identifier allows you to reference the outputs of that step in subsequent steps within the same job.
For example, in the workflow below, the step Create an Issue
action is assigned the ID create-issue
. Later, the output issue-id generated by this step can be accessed using the syntax ${{ steps.create-issue.outputs.issue-id }
} in the Get new issue id
step.
name: "MantisHub Example Workflow"
on:
workflow_dispatch:
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
repository: mantishub/action-create-issue
- name: Create an Issue
id: create-issue
uses: mantishub/action-create-issue@v1
with:
url: 'https://example.mantishub.io'
api-key: {{some-token}}
project: 'MyProject'
summary: 'Opening an sample issue'
description: |
This is a sample issue
Opened via Github Action
category: 'General'
- name: Get new issue id
run: echo ${{ steps.create-issue.outputs.issue-id }}