Init Parameters
RWX supports passing parameters into runs. You can use init params for any value that you want to specify when the run is started. The most common use case is passing a git reference to checkout.
CLI
Here's an example of passing init parameters using the CLI. Given this task definition in tasks.yml:
tasks:
- key: hello
run: echo "Hello $MY_NAME!"
env:
MY_NAME: ${{ init.my-name }}
Our init parameter is named my-name. We then set an environment variable named MY_NAME from its value following best practice (see Passing Values into Shell Commands). Now, when we run the CLI with:
rwx run tasks.yml --init my-name=Dan
The logs will contain the phrase Hello Dan!
Multiple Init Parameters
You can specify multiple parameters by passing --init multiple times.
tasks:
- key: hello
run: echo "Hello $FIRST_NAME $LAST_NAME!"
env:
FIRST_NAME: ${{ init.first-name }}
LAST_NAME: ${{ init.last-name }}
Run the CLI with:
rwx run tasks.yml --init first-name=Dan --init last-name=Manges
In this example, the logs will contain Hello Dan Manges!
Events
When triggering runs from events, such as a GitHub push event, you'll need to use the event context to specify input parameters.
Here's a common example using the git/clone package.
on:
github:
push:
init:
commit-sha: ${{ event.git.sha }}
base:
image: ubuntu:24.04
config: rwx/base 1.1.1
tasks:
- key: code
call: git/clone 2.0.7
with:
repository: https://github.com/YOUR_ORG/YOUR_REPO.git
ref: ${{ init.commit-sha }}
This approach enables you to pass the necessary values when starting runs from either events or the CLI.