You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$issueBody = $issueBody -replace "\n","%0A" # The content must be escaped to preserve newlines. See https://github.community/t/set-output-truncates-multiline-strings/16852/3
$issueBody = $issueBody -replace "\n","%0A" # The content must be escaped to preserve newlines. See https://github.community/t/set-output-truncates-multiline-strings/16852/3
Write-Output "::error title=Action check:Action should have failed the workflow because of invalid input but it didn't."
89
-
Exit 1
90
-
}
91
-
else {
92
-
Write-Output "::notice title=Action check::Action would have failed the workflow given invalid input. You should see an error message on the action's Annotations."
93
-
}
71
+
}'
72
+
73
+
Write-Output $issueAsJsonIndented
74
+
if($expectedIssueAsJson -eq $issueAsJsonIndented)
75
+
{
76
+
Write-Output "::notice title=Action check::Action produced the expected output. See the output from the step 'Output and assert parsed issue'."
77
+
}
78
+
else
79
+
{
80
+
Write-Output "::error title=Action check::Action didn't produce expected output. See the output from the step 'Output and assert parsed issue'."
81
+
Exit -1
82
+
}
83
+
84
+
test-failure:
85
+
name: Test failure
86
+
permissions:
87
+
contents: read
88
+
runs-on: ubuntu-latest
89
+
steps:
90
+
- name: Dump github context for debug purposes
91
+
env:
92
+
GITHUB_CONTEXT: ${{ toJSON(github) }}
93
+
- uses: actions/checkout@v3
94
+
- name: Run GitHub issue forms parser with bad input
Write-Output "::error title=Action check:Action should have failed the workflow because of invalid input but it didn't."
107
+
Exit 1
108
+
}
109
+
else
110
+
{
111
+
Write-Output "::notice title=Action check::Action would have failed the workflow given invalid input. You should see an error message on the action's Annotations."
-[Example output for a given issue form template and body](#example-output-for-a-given-issue-form-template-and-body)
17
+
-[Example usages of this action in GitHub workflows](#example-usages-of-this-action-in-github-workflows)
18
+
-[I can't figure out the structure of the JSON object produced by the parser](#i-cant-figure-out-the-structure-of-the-json-object-produced-by-the-parser)
19
+
-[Dev notes](#dev-notes)
20
+
21
+
## Description
22
+
12
23
A Docker container [GitHub action](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions) that can be used to parse [GitHub issue forms](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema).
13
24
14
25
## Usage
@@ -31,14 +42,14 @@ A Docker container [GitHub action](https://docs.github.com/en/actions/learn-gith
31
42
...
32
43
```
33
44
34
-
### Action inputs
45
+
## Action inputs
35
46
36
47
| Name | Description | Required
37
48
| --- | --- | --- |
38
49
| `template-filepath` | The filepath to the [issue form template](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#creating-issue-forms). | yes |
39
50
| `issue-form-body` | The body of the issue to parse. | yes |
-[Run tests with Visual Studio](#run-tests-with-visual-studio)
8
+
-[Run tests with dotnet CLI](#run-tests-with-dotnet-cli)
9
+
-[Debugging the `GitHubIssuesParserCli` project using Visual Studio](#debugging-the-githubissuesparsercli-project-using-visual-studio)
10
+
-[Building and running the Docker container action using Powershell against a set of test data](#building-and-running-the-docker-container-action-using-powershell-against-a-set-of-test-data)
-[Note about the Docker container action](#note-about-the-docker-container-action)
17
+
-[As of writing this, the log for building the docker action looks as follows](#as-of-writing-this-the-log-for-building-the-docker-action-looks-as-follows)
18
+
-[As of writing this, the log for running the docker action looks as follows](#as-of-writing-this-the-log-for-running-the-docker-action-looks-as-follows)
19
+
-[Other notes](#other-notes)
20
+
3
21
## Building the GitHubIssueFormsParser solution
4
22
5
23
### Building with Visual Studio
@@ -53,7 +71,14 @@ The steps below show how to run the Docker container action against a set of tes
53
71
1) Clone the repo and browse to the repo's directory.
54
72
2) Run `docker build -t github-issue-parser .`
55
73
3) Read the test issue form body into the variable `$issueBody` by doing: `$issueBody = Get-Content GitHubIssueFormsParser/tests/GitHubIssuesParserCli.Tests/TestFiles/IssueBody.md -Raw`
56
-
4) Run the docker container by executing `docker run --rm -v ${pwd}:/workspace --workdir /workspace github-issue-parser GitHubIssueFormsParser/tests/GitHubIssuesParserCli.Tests/TestFiles/Template.yml $issueBody`.
74
+
4) Run the docker container by executing:
75
+
76
+
```
77
+
docker run --rm -v ${pwd}:/workspace --workdir /workspace github-issue-parser `
0 commit comments