.mint dir

The Mint CLI will automatically pick up the contents of your .mint directory. This allows you to test changes locally without having to commit and push.

In addition to the specific file that you're running with --file, you can place other files in the .mint directory. This is especially helpful with docker compose, embedded runs, and dynamic tasks.

Embedded Runs

.mint/greeting.yml

tasks:
  - key: greeting
    run: echo "Hello $NAME!"
    env:
      NAME: ${{ init.name }}

.mint/example.yml

tasks:
  - key: greet-world
    call: ${{ run.mint-dir }}/greeting.yml
    init:
      name: 'World'

  - key: greet-rwx
    call: ${{ run.mint-dir }}/greeting.yml
    init:
      name: 'RWX'
mint run --file .mint/example.yml --open

Dynamic Tasks

If you generate dynamic tasks, you may want to place the scripts to generate the tasks in the .mint directory. This will enable you to work on the scripts without having to commit and push to test them.

.mint/support/generate-tasks.js

const yaml = require('yaml')

const tasks = ['a', 'b', 'c'].map((letter) => {
  return {
    key: letter,
    run: 'echo "this is task $LETTER"',
    env: {
      LETTER: letter,
    },
  }
})

process.stdout.write(yaml.stringify(tasks))

.mint/example.yml

tasks:
  - key: dynamic-tasks-node
    call: mint/install-node 1.1.0
    with:
      node-version: '22.12.0'

  - key: dynamic-tasks-deps
    use: dynamic-tasks-node
    run: |
      npm install -g [email protected]
      npm root -g > $MINT_ENV/NODE_PATH

  - key: generate-tasks
    use: dynamic-tasks-deps
    run: |
      node ${{ run.mint-dir.path }}/support/generate-tasks.js | tee $MINT_DYNAMIC_TASKS/tasks.yml

Caching

When using ${{ run.mint-dir.path }}, the entire contents of the mint directory is provided to the task. Therefore, any change within the Mint directory will affect the cache key for the task.

In the previous example with dynamic tasks, you'd actually want to specify the task like this:

- key: generate-tasks
  use: dynamic-tasks-deps
  run: |
    node ${{ run.mint-dir.path }}/support/generate-tasks.js | tee $MINT_DYNAMIC_TASKS/tasks.yml
  filter:
    ${{ run.mint-dir }}:
      - support/generate-tasks.js