|
| 1 | +[](https://github.com/codereaper/create-issue-action/actions/workflows/test.yaml) |
| 2 | + |
| 3 | +# Create Issue Action |
| 4 | + |
| 5 | +A simple GitHub Action that **creates, updates, comments on, or closes issues** using the GitHub CLI (`gh`). |
| 6 | + |
| 7 | +Ideal for CI/CD workflows that need to: |
| 8 | + |
| 9 | +- Automatically open or update tracking issues |
| 10 | +- Comment on existing issues from automation |
| 11 | +- Close issues after builds or deployments are complete |
| 12 | + |
| 13 | +## Features |
| 14 | + |
| 15 | +- Create new issues with titles, bodies, templates, labels, and assignees |
| 16 | +- Update existing issues automatically |
| 17 | +- Add comments to existing issues |
| 18 | +- Close issues by title and label search |
| 19 | +- Uses `gh` CLI under the hood (no extra dependencies) |
| 20 | + |
| 21 | +## Inputs |
| 22 | + |
| 23 | +| Name | Description | Default | Required | |
| 24 | +| ----------- | --------------------------------------------------------------------------------- | -------------------------- | -------- | |
| 25 | +| `token` | GitHub token (PAT or `${{ github.token }}`) used for authentication | `${{ github.token }}` | Yes | |
| 26 | +| `mode` | Operation mode: `create` or `close` | `create` | Yes | |
| 27 | +| `state` | Issue state filter when searching for existing issues: `open`, `closed`, or `all` | `open` | Yes | |
| 28 | +| `title` | Title of the issue to create or update | — | Yes | |
| 29 | +| `labels` | Comma-separated list of labels used for creation and search | — | No | |
| 30 | +| `assignees` | Comma-separated list of users to assign the issue to | — | No | |
| 31 | +| `body` | Custom body text for the issue (overrides `template`) | — | No | |
| 32 | +| `comment` | Optional comment text to add to an existing issue | — | No | |
| 33 | +| `repo` | Repository to operate on (`owner/repo`) | `${{ github.repository }}` | Yes | |
| 34 | + |
| 35 | +## Example Usage |
| 36 | + |
| 37 | +```yaml |
| 38 | +name: Reporting on failed builds |
| 39 | +on: |
| 40 | + push: |
| 41 | + branches: |
| 42 | + - main |
| 43 | + |
| 44 | +jobs: |
| 45 | + build: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Build |
| 52 | + run: make build |
| 53 | + |
| 54 | + report-failure: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + needs: build |
| 57 | + if: failure() |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + issues: write |
| 61 | + steps: |
| 62 | + - name: Report build failure |
| 63 | + uses: CodeReaper/create-issue-action@v1 |
| 64 | + with: |
| 65 | + title: "{{ github.workflow }} failed to build" |
| 66 | + labels: automation |
| 67 | + assignees: "@me" |
| 68 | + body: See [the action log](https://github.com/{{ github.repository }}/actions/runs/{{ github.run_id }}) for more details. |
| 69 | +``` |
| 70 | +
|
| 71 | +# License |
| 72 | +
|
| 73 | +This project is released under the [MIT License](LICENSE) |
0 commit comments