Skip to main content

Actions

Actions in ExecAPI are self-contained units of code that run inside a Docker container. To define an action, you first select the language you want to use (Python, Node.js, Bash, etc.), write the code that you want to execute, and list any dependencies that your code requires.

The action code is located at /code inside the container. You may write any code that can run within a Docker container, including calling external APIs, reading and writing files, and more. You may also use any third-party libraries that are available for your language of choice.

To ensure that your code runs smoothly, you should list any dependencies your code requires in your workflow definition. For example, if you are using Python, you might use a requirements.txt file to list the required packages. These dependencies will be installed on the first run of the workflow and cached for subsequent runs. You can access the cache volume at /cache within the container.

When your action runs, it is given a certain amount of resources to execute. Specifically, actions are given from 256 MB to 8 GB of RAM, and 0.25 to 8 vCPU of resources to execute. This allows you to scale the resources available to your action based on the needs of your code.

Finally, when your action runs, the environment variables EXECAPI_WORKFLOW_ID, EXECAPI_JOB_ID, and EXECAPI_JOB_ARGS are set. These variables can be used to access information about the workflow and job that your action is running in. For example, you might use the EXECAPI_JOB_ARGS variable to access any arguments that were passed to your job.

It is important to note that disk storage is ephemeral, meaning that any data that your action needs to save should be persisted using a third-party API. You can use a database, file storage service, or any other external service to persist data across multiple executions of your workflow.

Environment Variables

NameDefaultDescription
EXECAPI_WORKFLOW_ID-Workflow ID
EXECAPI_JOB_ID-Job ID
EXECAPI_JOB_ARGS-Jog arguments encoded as JSON