Skip to content

Commit a5c74a7

Browse files
Initial version (#1)
## Description - Reads the `${{ github.event.issue.body }}` or a provided markdown form using the official GitHub Issue Form spec. - Commented code is not extracted. - Supported types: - input - dropdown - textarea - checkboxes ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent af5e81d commit a5c74a7

File tree

13 files changed

+343
-194
lines changed

13 files changed

+343
-194
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.yml text eol=lf

.github/workflows/Action-Test.yml

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
1-
name: Action-Test
2-
3-
run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
4-
5-
on: [pull_request]
6-
7-
concurrency:
8-
group: ${{ github.workflow }}-${{ github.ref }}
9-
cancel-in-progress: true
10-
11-
permissions:
12-
contents: read
13-
pull-requests: read
14-
15-
jobs:
16-
ActionTestBasic:
17-
name: Action-Test - [Basic]
18-
runs-on: ubuntu-latest
19-
steps:
20-
# Need to check out as part of the test, as its a local action
21-
- name: Checkout repo
22-
uses: actions/checkout@v4
23-
24-
- name: Action-Test
25-
uses: ./
26-
with:
27-
working-directory: ./tests
28-
subject: PSModule
1+
name: Action-Test
2+
3+
run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
4+
5+
on: [pull_request]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
pull-requests: read
14+
15+
jobs:
16+
ActionTestBasic:
17+
name: Action-Test - [Basic]
18+
runs-on: ubuntu-latest
19+
steps:
20+
# Need to check out as part of the test, as its a local action
21+
- name: Checkout repo
22+
uses: actions/checkout@v4
23+
24+
- name: Get issue file content
25+
id: GetIssueFileContent
26+
shell: pwsh
27+
run: |
28+
$issueFileContent = Get-Content -Path tests/IssueBody.md -Raw
29+
30+
$EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)})
31+
"issueFileContent<<$EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
32+
$issueFileContent | Out-File -FilePath $env:GITHUB_OUTPUT -Append
33+
"$EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
34+
35+
- uses: PSModule/Debug@v0
36+
if: always()
37+
38+
- name: Action-Test
39+
id: Action-Test
40+
uses: ./
41+
with:
42+
IssueBody: ${{ steps.GetIssueFileContent.outputs.issueFileContent }}
43+
44+
- name: Action-Test-Results
45+
shell: pwsh
46+
env:
47+
data: ${{ steps.Action-Test.outputs.data }}
48+
run: |
49+
Invoke-Pester -Path tests

.github/workflows/Auto-Configure.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/Auto-Document.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/Auto-Release.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
name: Auto-Release
2-
3-
run-name: "Auto-Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
4-
5-
on:
6-
pull_request_target:
7-
branches:
8-
- main
9-
types:
10-
- closed
11-
- opened
12-
- reopened
13-
- synchronize
14-
- labeled
15-
16-
concurrency:
17-
group: ${{ github.workflow }}-${{ github.ref }}
18-
cancel-in-progress: true
19-
20-
permissions:
21-
contents: write # Required to create releases
22-
pull-requests: write # Required to create comments on the PRs
23-
24-
jobs:
25-
Auto-Release:
26-
runs-on: ubuntu-latest
27-
steps:
28-
- name: Checkout Code
29-
uses: actions/checkout@v4
30-
31-
- name: Auto-Release
32-
uses: PSModule/Auto-Release@v1
33-
env:
34-
GITHUB_TOKEN: ${{ github.token }}
1+
name: Auto-Release
2+
3+
run-name: "Auto-Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
4+
5+
on:
6+
pull_request_target:
7+
branches:
8+
- main
9+
types:
10+
- closed
11+
- opened
12+
- reopened
13+
- synchronize
14+
- labeled
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
permissions:
21+
contents: write # Required to create releases
22+
pull-requests: write # Required to create comments on the PRs
23+
24+
jobs:
25+
Auto-Release:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout Code
29+
uses: actions/checkout@v4
30+
31+
- name: Auto-Release
32+
uses: PSModule/Auto-Release@v1
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/Linter.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
name: Linter
2-
3-
run-name: "Linter - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
4-
5-
on: [pull_request]
6-
7-
concurrency:
8-
group: ${{ github.workflow }}-${{ github.ref }}
9-
cancel-in-progress: true
10-
11-
permissions:
12-
contents: read
13-
packages: read
14-
statuses: write
15-
16-
jobs:
17-
Lint:
18-
name: Lint code base
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: Checkout repo
22-
uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
25-
26-
- name: Lint code base
27-
uses: super-linter/super-linter/slim@latest
28-
env:
29-
GITHUB_TOKEN: ${{ github.token }}
1+
name: Linter
2+
3+
run-name: "Linter - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
4+
5+
on: [pull_request]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
packages: read
14+
statuses: write
15+
16+
jobs:
17+
Lint:
18+
name: Lint code base
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repo
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Lint code base
27+
uses: super-linter/super-linter/slim@latest
28+
env:
29+
GITHUB_TOKEN: ${{ github.token }}

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
# Template-action
1+
# Get-IssueFormData
22

3-
A template repository for GitHub Actions
3+
Reads the body of an issue and parses it into a JSON object.
4+
5+
Bases itself on the definitions of GitHub Issue Forms:
6+
7+
- [Syntax for issue forms | GitHub Docs](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms)
8+
- [Syntax for GitHub's form schema](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema)
49

510
## Usage
611

@@ -10,8 +15,26 @@ A template repository for GitHub Actions
1015

1116
### Outputs
1217

18+
The data structure that is returned is a JSON object that contains the following properties:
19+
20+
```json
21+
{
22+
"<header1>": "<value1>", // input
23+
"<header2>": "<value2>", // dropdown
24+
"<header3>": "<value3.1>\n<value3.2>\n<value3.3>", // textarea
25+
"<header4>": { // checkbox
26+
"<valuename>": true,
27+
"<valuename>": false
28+
}
29+
}
30+
```
31+
1332
### Example
1433

1534
```yaml
1635
Example here
1736
```
37+
38+
## Inspiration
39+
40+
- [zentered/issue-forms-body-parser](https://github.com/zentered/issue-forms-body-parser)

action.yml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
name: '{{ NAME }}'
2-
description: '{{ DESCRIPTION }}'
3-
author: PSModule
4-
branding:
5-
icon: upload-cloud
6-
color: white
7-
8-
inputs:
9-
working-directory:
10-
description: The working directory where Terraform will be executed
11-
required: false
12-
subject:
13-
description: The subject to greet
14-
required: false
15-
default: World
16-
17-
runs:
18-
using: composite
19-
steps:
20-
- name: '{{ NAME }}'
21-
shell: pwsh
22-
working-directory: ${{ inputs.working-directory }}
23-
env:
24-
GITHUB_ACTION_INPUT_subject: ${{ inputs.subject }}
25-
run: |
26-
# '{{ NAME }}'
27-
. "$env:GITHUB_ACTION_PATH\scripts\main.ps1" -Verbose
1+
name: Get-IssueFormData
2+
description: Get the data from a issue that was generated based on a issue form
3+
author: PSModule
4+
branding:
5+
icon: upload-cloud
6+
color: white
7+
8+
inputs:
9+
IssueBody:
10+
description: The body of the issue
11+
required: false
12+
default: ${{ github.event.issue.body }}
13+
14+
outputs:
15+
data:
16+
description: The data from the issue body
17+
value: ${{ steps.Get-IssueFormData.outputs.data }}
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Get-IssueFormData
23+
id: Get-IssueFormData
24+
shell: pwsh
25+
env:
26+
GITHUB_ACTION_INPUT_IssueBody: ${{ inputs.IssueBody }}
27+
run: |
28+
# Get-IssueFormData
29+
. "$env:GITHUB_ACTION_PATH\scripts\main.ps1" -Verbose

0 commit comments

Comments
 (0)