https://github.com/benlei/parse-issue-templateless
Parses fields of an issue that may or may not have been created via an Issue Template, but without the template, based on the headings
https://github.com/benlei/parse-issue-templateless
github-actions issueops workflows
Last synced: 5 months ago
JSON representation
Parses fields of an issue that may or may not have been created via an Issue Template, but without the template, based on the headings
- Host: GitHub
- URL: https://github.com/benlei/parse-issue-templateless
- Owner: benlei
- License: mit
- Created: 2024-09-15T23:24:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T19:35:03.000Z (over 1 year ago)
- Last Synced: 2026-01-18T12:16:08.773Z (5 months ago)
- Topics: github-actions, issueops, workflows
- Language: TypeScript
- Homepage:
- Size: 1.53 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# benlei/parse-issue-templateless
[](https://github.com/super-linter/super-linter)

[](https://github.com/benlei/parse-issue-templateless/actions/workflows/check-dist.yml)
[](https://github.com/benlei/parse-issue-templateless/actions/workflows/codeql-analysis.yml)
[](./badges/coverage.svg)
This action will try to parse a `body`, or an issue's body, for fields as if it
were created by an issue template. Keep in mind that because this is
templateless, it assumes all the contents of each field are strings.
## Inputs
| Input Name | Required | Default | Description |
| --------------- | -------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `repository` | no | `${{ github.repository }}` | The repository to find issue in, if trying to fetch an issue's body |
| `token` | no | `${{ github.token }}` | The GitHub token to use for searching for issue |
| `body` | no | `''` | The body to parse |
| `issue-number` | no | `''` | The issue number to try to fetch the body from for parsing. Ignored if `body` input is specified/has content. |
| `issue-title` | no | `''` | The exact issue title to search for to try to fetch the body from for parsing. Ignored if `body` or `issue-number` input is specified/has content. |
| `fail-on-error` | no | `true` | Whether or not to fail action if any error occurs |
## Outputs
| Output Name | Description |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `issue-number` | The issue number that was found, if an issue was fetched/searched for |
| `*` | The headings are slugified (lowercased, alphanumeric chars only) before having its content set as the output. For example, if you had the heading `Hello World`, you can expect the output `hello-world` to have been set from this step |
## Examples
### Parse by Body
````yaml
- name: Test Local Action - Body
id: test
uses: benlei/parse-issue-templateless@v1
env:
ISSUE_BODY: |
### Issue Title
This is the body of the issue
```yaml
time: 10
```
And that's about it
### Something Else 123
1235768457246
### Third Heading over here...
Hello World
with:
body: ${{ env.ISSUE_BODY }}
- name: Outputs are not correct
if: |
steps.test.outputs.issue-number != '' ||
!contains(steps.test.outputs.issue-title, 'time: 10') ||
!contains(steps.test.outputs.issue-title, 'about it') ||
steps.test.outputs.something-else-123 != '1235768457246' ||
steps.test.outputs.third-heading-over-here != 'Hello World'
run: exit 1
````
### Parse by Issue Number
```yaml
- name: Test Local Action - Issue Number
id: test
uses: benlei/parse-issue-templateless@v1
with:
issue-number: 3
- name: Outputs are not correct
if: |
steps.test.outputs.issue-number != '3' ||
!contains(steps.test.outputs.issue-title, 'time: 10') ||
!contains(steps.test.outputs.issue-title, 'about it') ||
steps.test.outputs.something-else-123 != '1235768457246' ||
steps.test.outputs.third-heading-over-here != 'Hello World'
run: exit 1
```
### Parse by Exact Issue Title
```yaml
- name: Test Local Action - Issue Title
id: test
uses: benlei/parse-issue-templateless@v1
with:
issue-title: Issue with example contents
- name: Outputs are not correct
if: |
steps.test.outputs.issue-number != '3' ||
!contains(steps.test.outputs.issue-title, 'time: 10') ||
!contains(steps.test.outputs.issue-title, 'about it') ||
steps.test.outputs.something-else-123 != '1235768457246' ||
steps.test.outputs.third-heading-over-here != 'Hello World'
run: exit 1
```