Files

46 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2019-08-01 11:26:17 -04:00
# Action Types
There are two types of actions. JavaScript and Docker actions.
- **JavaScript Actions**: JavaScript actions run on the host machine. The unit of work is decoupled from the environment.
2019-08-08 11:40:24 -06:00
- **Docker Actions**: A container action is a container which carries both the unit of work along with the environment and its dependencies packaged up as a container.
2019-08-01 11:26:17 -04:00
Both have access to the workspace and the github event payload and context.
## Why would I choose a Docker action?
Docker actions carry both the unit of work and the environment.
2019-08-08 11:40:24 -06:00
This creates a more consistent and reliable unit of work where the consumer of the action does not need to worry about the toolsets and its dependencies.
2019-08-01 11:26:17 -04:00
Docker actions are currently limited to Linux only.
## Why would I choose a host action?
JavaScript actions decouple the unit of work from the environment and run directly on the host machine or VM.
2019-08-19 01:38:45 +02:00
Consider a simple example of testing a node lib on node 8, 10 and running a custom action. Each job will setup a node version on the host and custom-action will run its unit of work on each environment (node8+ubuntu16, node8+windows-2019, etc.)
2019-08-01 11:26:17 -04:00
```yaml
on: push
jobs:
build:
strategy:
matrix:
node: [8.x, 10.x]
os: [ubuntu-16.04, windows-2019]
runs-on: ${{matrix.os}}
actions:
2023-01-03 16:38:50 +01:00
- uses: actions/setup-node@v3
2019-08-01 11:26:17 -04:00
with:
version: ${{matrix.node}}
- run: |
npm install
- run: |
npm test
2020-07-21 11:33:05 -04:00
- uses: actions/custom-action@v1
2019-08-01 11:26:17 -04:00
```
2019-08-08 11:40:24 -06:00
JavaScript actions work on any environment that host action runtime is supported on which is currently node 12. However, a host action that runs a toolset expects the environment that it's running on to have that toolset in its PATH or using a setup-* action to acquire it on demand.