Init Parameters

Mint 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 ${{ init.name }}!

Run the CLI with:

mint run --file tasks.yml --init name=Dan

And when the task runs, you'll see that the logs will contain Hello Dan!

Multiple Init Parameters

You can specify multiple parameters by passing --init multiple times.

tasks:
  - key: hello
    run: echo Hello ${{ init.first-name }} ${{ init.last-name }}!

Run the CLI with:

mint run --file 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 mint/git-clone leaf.

on:
  github:
    push:
      init:
        commit-sha: ${{ event.git.sha }}

tasks:
  - key: code
    call: mint/git-clone 1.5.0
    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.