add multi line example and test

This commit is contained in:
Nick Fields
2021-06-10 17:44:58 -04:00
parent bebba89192
commit b00fd808da
2 changed files with 48 additions and 5 deletions

View File

@@ -141,7 +141,6 @@ jobs:
expected: 2
actual: ${{ steps.retry_on_error.outputs.exit_code }}
# timeout tests (takes longer to run so run last)
- name: sad-path (timeout)
id: sad_path_timeout
@@ -225,7 +224,7 @@ jobs:
timeout_minutes: 1
max_attempts: 2
shell: cmd
command: "dir"
command: 'dir'
- uses: nick-invision/assert-action@v1
with:
expected: 2
@@ -269,6 +268,23 @@ jobs:
max_attempts: 2
shell: python
command: print('1', '2', '3')
- name: Multi-line multi-command Test
uses: ./
with:
timeout_minutes: 1
max_attempts: 2
command: |
print('a', 'b', 'c')
print('1', '2', '3')
- name: Multi-line single-command Test
uses: ./
with:
timeout_minutes: 1
max_attempts: 2
shell: cmd
command: >-
echo "this is
a test"
# runs on push to master only
cd:

View File

@@ -25,8 +25,8 @@ Retries an Action step on failure or timeout. This is currently intended to repl
**Optional** Number of seconds to wait before attempting the next retry. Defaults to `10`
### `shell`
**Optional** Shell to use to execute `command`. Defaults to `powershell` on Windows, `bash` otherwise. Supports bash, python, pwsh, sh, cmd, and powershell per [docs](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell)
**Optional** Shell to use to execute `command`. Defaults to `powershell` on Windows, `bash` otherwise. Supports bash, python, pwsh, sh, cmd, and powershell per [docs](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell)
### `polling_interval_seconds`
@@ -42,7 +42,7 @@ Retries an Action step on failure or timeout. This is currently intended to repl
### `on_retry_command`
**Optional** Command to run before a retry (such as a cleanup script). Any error thrown from retry command is caught and surfaced as a warning.
**Optional** Command to run before a retry (such as a cleanup script). Any error thrown from retry command is caught and surfaced as a warning.
## Outputs
@@ -153,6 +153,33 @@ with:
on_retry_command: npm run cleanup-flaky-script-output
```
### Run multi-line, multi-command script
```yaml
name: Multi-line multi-command Test
uses: ./
with:
timeout_minutes: 1
max_attempts: 2
command: |
print('a', 'b', 'c')
print('1', '2', '3')
```
### Run multi-line, single-command script
```yaml
name: Multi-line single-command Test
uses: ./
with:
timeout_minutes: 1
max_attempts: 2
shell: cmd
command: >-
echo "this is
a test"
```
## Requirements
NodeJS is required for this action to run. This runs without issue on all GitHub hosted runners but if you are running into issues with this on self hosted runners ensure NodeJS is installed.