script¶
Execute a script.
Saturn sets the current working directory of the script to the checkout of a repository.
The script has access to the environment variable TASK_DIR, which is set to the absolute
path to the directory that contains the task file.
It allows the script to load additional files stored next to the task file.
Parameters¶
script¶
The script to execute. Mutually exclusive with scriptFromFile.
Supports template variables.
| Name | Value |
|---|---|
| Type | string |
| Required | No |
| Default | "" |
scriptFromFile¶
The script to execute. Reads the content from a file. The path to the file can be an absolute path or relative to the task file. Mutually exclusive with script.
Supports template variables.
| Name | Value |
|---|---|
| Type | string |
| Required | No |
| Default | "" |
shell¶
The path to the shell that executes the script.
| Name | Value |
|---|---|
| Type | string |
| Required | No |
| Default | sh |
timeout¶
Timeout after which the script process is shut down. Waits 10 seconds by default.
The value is a Go duration string.
| Name | Value |
|---|---|
| Type | string |
| Required | No |
| Default | 10s |
Examples¶
actions:
- action: script
params:
# Path to file must be relative.
# Otherwise the shell searches in locations of $PATH.
script: |
./file-in-repo.sh
actions:
- action: script
params:
# Read the file "hello.txt", which is located
# next to the task file and
# write it to file "hello-repo.txt"
# in the repository.
script: |
cat "${TASK_DIR}/hello.txt" > hello-repo.txt
# Load the content of the script from a file.
# The script "example.sh" is located in the same directory as the Task file.
actions:
- action: script
params:
scriptFromFile: "./example.sh"