Below is my github actions ISSUE_TEMPLATE that seeks input from user.
name: GH Action details
description: GH Issue form
title: "GH Action details"
assignees:
- my-devops
labels:
- "gh inventory"
body:
- type: markdown
attributes:
value: |
### Want to add?
---
Please fill out the information below
- type: input
id: repository-name
attributes:
label: Repository Name
description: Provide the name of the repository
validations:
required: true
Below is how the issue form looks before and after user comments.
Desired output where the user input is read and displayed.

I wish to submit a similar issue comment using PowerShell. Tried the below [You can try to run on your system using ISE, powershell]: Powershell code below:
$Token = "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"
$RepoOwner = "knowyrtech"
$RepoName = "mongomaskwinvslinux"
$IssueTitle = "GH Action Onboard inventory details"
# Create a hashtable for the input values
$inputValues = @{
"ref" = "main"
"inputs" = @{
"repository-name" = "YourRepositoryName"
}
}
# Convert the hashtable to JSON
$inputJson = $inputValues | ConvertTo-Json
$ApiUrl = "https://api.github.com/repos/$RepoOwner/$RepoName/issues"
$IssueData = @{
title = $IssueTitle
body = $inputJson
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri $ApiUrl -Method Post -Headers @{
"Authorization" = "token $Token"
"Accept" = "application/vnd.github.v3+json"
} -ContentType "application/json" -Body $IssueData
$response
Running this creates a comment but not as desired output snapshot shared above.
I also tried
$inputValues = @{
"ref" = "main"
"inputs" = @{
"repository-name" = @{
"default" = 'wowo'
}
}
}
$inputJson = $inputValues | ConvertTo-Json
However, unable to comment as inputs as you can see below:
Kindly suggest.



In your script, you are creating a JSON object representing what seems to be inputs for an action workflow and used that JSON object directly as the body of the GitHub issue:
Since GitHub issues created through the API do not natively support the direct population of issue form fields in this manner. GitHub Issue Forms and the GitHub API work separately; the API does not provide functionality to populate Issue Forms fields directly.
Instead of trying to use a JSON object to represent the issue body, you can try and use a Markdown formatted string to represent the issue body, which includes the default values you want to include in a structured manner that visually resembles your GitHub Issue Form:
The
$IssueBodyvariable contains a string with Markdown formatting, which structures the information similarly to your GitHub Issue Form when viewed on the GitHub platform.Full script: