Merge branch 'main' into al-cheb/windows-default-shell
This commit is contained in:
@@ -21,17 +21,17 @@ Workflow files use YAML syntax, and must have either a `.yml` or `.yaml` file ex
|
||||
|
||||
You must store workflow files in the `.github/workflows` directory of your repository.
|
||||
|
||||
### **`name`**
|
||||
### `name`
|
||||
|
||||
The name of your workflow. {% data variables.product.prodname_dotcom %} displays the names of your workflows on your repository's actions page. If you omit `name`, {% data variables.product.prodname_dotcom %} sets it to the workflow file path relative to the root of the repository.
|
||||
|
||||
### **`on`**
|
||||
### `on`
|
||||
|
||||
**Required** The name of the {% data variables.product.prodname_dotcom %} event that triggers the workflow. You can provide a single event `string`, `array` of events, `array` of event `types`, or an event configuration `map` that schedules a workflow or restricts the execution of a workflow to specific files, tags, or branch changes. For a list of available events, see "[Events that trigger workflows](/articles/events-that-trigger-workflows)."
|
||||
|
||||
{% data reusables.github-actions.actions-on-examples %}
|
||||
|
||||
### **`on.<event_name>.types`**
|
||||
### `on.<event_name>.types`
|
||||
|
||||
Selects the types of activity that will trigger a workflow run. Most GitHub events are triggered by more than one type of activity. For example, the event for the release resource is triggered when a release is `published`, `unpublished`, `created`, `edited`, `deleted`, or `prereleased`. The `types` keyword enables you to narrow down activity that causes the workflow to run. When only one activity type triggers a webhook event, the `types` keyword is unnecessary.
|
||||
|
||||
@@ -45,7 +45,7 @@ on:
|
||||
types: [published, created, edited]
|
||||
```
|
||||
|
||||
### **`on.<push|pull_request>.<branches|tags>`**
|
||||
### `on.<push|pull_request>.<branches|tags>`
|
||||
|
||||
When using the `push` and `pull_request` events, you can configure a workflow to run on specific branches or tags. For a `pull_request` event, only branches and tags on the base are evaluated. If you define only `tags` or only `branches`, the workflow won't run for events affecting the undefined Git ref.
|
||||
|
||||
@@ -112,7 +112,7 @@ on:
|
||||
- '!releases/**-alpha'
|
||||
```
|
||||
|
||||
### **`on.<push|pull_request>.paths`**
|
||||
### `on.<push|pull_request>.paths`
|
||||
|
||||
When using the `push` and `pull_request` events, you can configure a workflow to run when at least one file does not match `paths-ignore` or at least one modified file matches the configured `paths`. Path filters are not evaluated for pushes to tags.
|
||||
|
||||
@@ -179,13 +179,13 @@ The filter determines if a workflow should run by evaluating the changed files a
|
||||
|
||||
For more information, see "[About comparing branches in pull requests](/articles/about-comparing-branches-in-pull-requests)."
|
||||
|
||||
### **`on.schedule`**
|
||||
### `on.schedule`
|
||||
|
||||
{% data reusables.repositories.actions-scheduled-workflow-example %}
|
||||
|
||||
For more information about cron syntax, see "[Events that trigger workflows](/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events)."
|
||||
|
||||
### **`env`**
|
||||
### `env`
|
||||
|
||||
A `map` of environment variables that are available to all jobs and steps in the workflow. You can also set environment variables that are only available to a job or step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps.env`](#jobsjob_idstepsenv).
|
||||
|
||||
@@ -198,13 +198,13 @@ env:
|
||||
SERVER: production
|
||||
```
|
||||
|
||||
### **`defaults`**
|
||||
### `defaults`
|
||||
|
||||
A `map` of default settings that will apply to all jobs in the workflow. You can also set default settings that are only available to a job. For more information, see [`jobs.<job_id>.defaults`](#jobsjob_iddefaults).
|
||||
|
||||
{% data reusables.github-actions.defaults-override %}
|
||||
|
||||
### **`defaults.run`**
|
||||
### `defaults.run`
|
||||
|
||||
You can provide default `shell` and `working-directory` options for all [`run`](#jobsjob_idstepsrun) steps in a workflow. You can also set default settings for `run` that are only available to a job. For more information, see [`jobs.<job_id>.defaults.run`](#jobsjob_iddefaultsrun). You cannot use contexts or expressions in this keyword.
|
||||
|
||||
@@ -219,7 +219,7 @@ defaults:
|
||||
working-directory: scripts
|
||||
```
|
||||
|
||||
### **`jobs`**
|
||||
### `jobs`
|
||||
|
||||
A workflow run is made up of one or more jobs. Jobs run in parallel by default. To run jobs sequentially, you can define dependencies on other jobs using the `jobs.<job_id>.needs` keyword.
|
||||
|
||||
@@ -227,9 +227,9 @@ Each job runs in an environment specified by `runs-on`.
|
||||
|
||||
You can run an unlimited number of jobs as long as you are within the workflow usage limits. For more information, see "[Usage limits and billing](/actions/reference/usage-limits-billing-and-administration)" for {% data variables.product.prodname_dotcom %}-hosted runners and "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners/#usage-limits)" for self-hosted runner usage limits.
|
||||
|
||||
If you need to find the unique identifier of a job running in a workflow run, you can use the {% data variables.product.prodname_dotcom %} API. For more information, see "[Workflow Jobs](/v3/actions/workflow-jobs)."
|
||||
If you need to find the unique identifier of a job running in a workflow run, you can use the {% data variables.product.prodname_dotcom %} API. For more information, see "[Workflow Jobs](/rest/reference/actions#workflow-jobs)."
|
||||
|
||||
### **`jobs.<job_id>`**
|
||||
### `jobs.<job_id>`
|
||||
|
||||
Each job must have an id to associate with the job. The key `job_id` is a string and its value is a map of the job's configuration data. You must replace `<job_id>` with a string that is unique to the `jobs` object. The `<job_id>` must start with a letter or `_` and contain only alphanumeric characters, `-`, or `_`.
|
||||
|
||||
@@ -243,11 +243,11 @@ jobs:
|
||||
name: My second job
|
||||
```
|
||||
|
||||
### **`jobs.<job_id>.name`**
|
||||
### `jobs.<job_id>.name`
|
||||
|
||||
The name of the job displayed on {% data variables.product.prodname_dotcom %}.
|
||||
|
||||
### **`jobs.<job_id>.needs`**
|
||||
### `jobs.<job_id>.needs`
|
||||
|
||||
Identifies any jobs that must complete successfully before this job will run. It can be a string or array of strings. If a job fails, all jobs that need it are skipped unless the jobs use a conditional statement that causes the job to continue.
|
||||
|
||||
@@ -270,7 +270,7 @@ The jobs in this example run sequentially:
|
||||
2. `job2`
|
||||
3. `job3`
|
||||
|
||||
### **`jobs.<job_id>.runs-on`**
|
||||
### `jobs.<job_id>.runs-on`
|
||||
|
||||
**Required** The type of machine to run the job on. The machine can be either a {% data variables.product.prodname_dotcom %}-hosted runner or a self-hosted runner.
|
||||
|
||||
@@ -286,7 +286,7 @@ Available {% data variables.product.prodname_dotcom %}-hosted runner types are:
|
||||
|
||||
{% data reusables.github-actions.ubuntu-runner-preview %}
|
||||
|
||||
##### **Example**
|
||||
##### Example
|
||||
|
||||
```yaml
|
||||
runs-on: ubuntu-latest
|
||||
@@ -298,7 +298,7 @@ For more information, see "[Virtual environments for {% data variables.product.p
|
||||
|
||||
{% data reusables.github-actions.self-hosted-runner-labels-runs-on %}
|
||||
|
||||
##### **Example**
|
||||
##### Example
|
||||
|
||||
```yaml
|
||||
runs-on: [self-hosted, linux]
|
||||
@@ -306,7 +306,7 @@ runs-on: [self-hosted, linux]
|
||||
|
||||
For more information, see "[About self-hosted runners](/github/automating-your-workflow-with-github-actions/about-self-hosted-runners)" and "[Using self-hosted runners in a workflow](/github/automating-your-workflow-with-github-actions/using-self-hosted-runners-in-a-workflow)."
|
||||
|
||||
### **`jobs.<job_id>.outputs`**
|
||||
### `jobs.<job_id>.outputs`
|
||||
|
||||
A `map` of outputs for a job. Job outputs are available to all downstream jobs that depend on this job. For more information on defining job dependencies, see [`jobs.<job_id>.needs`](#jobsjob_idneeds).
|
||||
|
||||
@@ -314,7 +314,7 @@ Job outputs are strings, and job outputs containing expressions are evaluated on
|
||||
|
||||
To use job outputs in a dependent job, you can use the `needs` context. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#needs-context)."
|
||||
|
||||
#### **Example**
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -338,13 +338,13 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### **`jobs.<job_id>.env`**
|
||||
### `jobs.<job_id>.env`
|
||||
|
||||
A `map` of environment variables that are available to all steps in the job. You can also set environment variables for the entire workflow or an individual step. For more information, see [`env`](#env) and [`jobs.<job_id>.steps.env`](#jobsjob_idstepsenv).
|
||||
|
||||
{% data reusables.repositories.actions-env-var-note %}
|
||||
|
||||
#### **Example**
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@@ -353,13 +353,13 @@ jobs:
|
||||
FIRST_NAME: Mona
|
||||
```
|
||||
|
||||
### **`jobs.<job_id>.defaults`**
|
||||
### `jobs.<job_id>.defaults`
|
||||
|
||||
A `map` of default settings that will apply to all steps in the job. You can also set default settings for the entire workflow. For more information, see [`defaults`](#defaults).
|
||||
|
||||
{% data reusables.github-actions.defaults-override %}
|
||||
|
||||
### **`jobs.<job_id>.defaults.run`**
|
||||
### `jobs.<job_id>.defaults.run`
|
||||
|
||||
Provide default `shell` and `working-directory` to all `run` steps in the job. Context and expression are not allowed in this section.
|
||||
|
||||
@@ -379,13 +379,13 @@ jobs:
|
||||
working-directory: scripts
|
||||
```
|
||||
|
||||
### **`jobs.<job_id>.if`**
|
||||
### `jobs.<job_id>.if`
|
||||
|
||||
You can use the `if` conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.
|
||||
|
||||
{% data reusables.github-actions.expression-syntax-if %} For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
|
||||
|
||||
### **`jobs.<job_id>.steps`**
|
||||
### `jobs.<job_id>.steps`
|
||||
|
||||
A job contains a sequence of tasks called `steps`. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the runner environment and has access to the workspace and filesystem. Because steps run in their own process, changes to environment variables are not preserved between steps. {% data variables.product.prodname_dotcom %} provides built-in steps to set up and complete a job.
|
||||
|
||||
@@ -415,17 +415,17 @@ jobs:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
#### **`jobs.<job_id>.steps.id`**
|
||||
### `jobs.<job_id>.steps.id`
|
||||
|
||||
A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
|
||||
|
||||
#### **`jobs.<job_id>.steps.if`**
|
||||
### `jobs.<job_id>.steps.if`
|
||||
|
||||
You can use the `if` conditional to prevent a step from running unless a condition is met. You can use any supported context and expression to create a conditional.
|
||||
|
||||
{% data reusables.github-actions.expression-syntax-if %} For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
|
||||
|
||||
##### Example using contexts
|
||||
#### Example using contexts
|
||||
|
||||
This step only runs when the event type is a `pull_request` and the event action is `unassigned`.
|
||||
|
||||
@@ -436,7 +436,7 @@ steps:
|
||||
run: echo This event is a pull request that had an assignee removed.
|
||||
```
|
||||
|
||||
##### Example using status check functions
|
||||
#### Example using status check functions
|
||||
|
||||
The `my backup step` only runs when the previous step of a job fails. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions)."
|
||||
|
||||
@@ -449,11 +449,11 @@ steps:
|
||||
uses: actions/heroku@1.0.0
|
||||
```
|
||||
|
||||
#### **`jobs.<job_id>.steps.name`**
|
||||
### `jobs.<job_id>.steps.name`
|
||||
|
||||
A name for your step to display on {% data variables.product.prodname_dotcom %}.
|
||||
|
||||
#### **`jobs.<job_id>.steps.uses`**
|
||||
### `jobs.<job_id>.steps.uses`
|
||||
|
||||
Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a [published Docker container image](https://hub.docker.com/).
|
||||
|
||||
@@ -466,7 +466,7 @@ Some actions require inputs that you must set using the [`with`](#jobsjob_idstep
|
||||
|
||||
Actions are either JavaScript files or Docker containers. If the action you're using is a Docker container you must run the job in a Linux environment. For more details, see [`runs-on`](#jobsjob_idruns-on).
|
||||
|
||||
##### Example using versioned actions
|
||||
#### Example using versioned actions
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -480,7 +480,7 @@ steps:
|
||||
- uses: actions/setup-node@main
|
||||
```
|
||||
|
||||
##### Example using a public action
|
||||
#### Example using a public action
|
||||
|
||||
`{owner}/{repo}@{ref}`
|
||||
|
||||
@@ -498,7 +498,7 @@ jobs:
|
||||
uses: actions/aws@v2.0.1
|
||||
```
|
||||
|
||||
##### Example using a public action in a subdirectory
|
||||
#### Example using a public action in a subdirectory
|
||||
|
||||
`{owner}/{repo}/{path}@{ref}`
|
||||
|
||||
@@ -512,7 +512,7 @@ jobs:
|
||||
uses: actions/aws/ec2@main
|
||||
```
|
||||
|
||||
##### Example using action in the same repository as the workflow
|
||||
#### Example using action in the same repository as the workflow
|
||||
|
||||
`./path/to/dir`
|
||||
|
||||
@@ -528,7 +528,7 @@ jobs:
|
||||
uses: ./.github/actions/my-action
|
||||
```
|
||||
|
||||
##### Example using a Docker Hub action
|
||||
#### Example using a Docker Hub action
|
||||
|
||||
`docker://{image}:{tag}`
|
||||
|
||||
@@ -542,7 +542,7 @@ jobs:
|
||||
uses: docker://alpine:3.8
|
||||
```
|
||||
|
||||
##### Example using a Docker public registry action
|
||||
#### Example using a Docker public registry action
|
||||
|
||||
`docker://{host}/{image}:{tag}`
|
||||
|
||||
@@ -556,7 +556,7 @@ jobs:
|
||||
uses: docker://gcr.io/cloud-builders/gradle
|
||||
```
|
||||
|
||||
#### **`jobs.<job_id>.steps.run`**
|
||||
### `jobs.<job_id>.steps.run`
|
||||
|
||||
Runs command-line programs using the operating system's shell. If you do not provide a `name`, the step name will default to the text specified in the `run` command.
|
||||
|
||||
@@ -588,7 +588,7 @@ Using the `working-directory` keyword, you can specify the working directory of
|
||||
working-directory: ./temp
|
||||
```
|
||||
|
||||
##### Using a specific shell
|
||||
#### Using a specific shell
|
||||
|
||||
You can override the default shell settings in the runner's operating system using the `shell` keyword. You can use built-in `shell` keywords, or you can define a custom set of shell options.
|
||||
|
||||
@@ -602,7 +602,7 @@ You can override the default shell settings in the runner's operating system usi
|
||||
| Windows | `pwsh` | This is the default shell used on Windows. The PowerShell Core. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `pwsh -command ". '{0}'"`. |
|
||||
| Windows | `powershell` | The PowerShell Desktop. {% data variables.product.prodname_dotcom %} appends the extension `.ps1` to your script name. | `powershell -command ". '{0}'"`. |
|
||||
|
||||
##### Example running a script using bash
|
||||
#### Example running a script using bash
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -611,7 +611,7 @@ steps:
|
||||
shell: bash
|
||||
```
|
||||
|
||||
##### Example running a script using Windows `cmd`
|
||||
#### Example running a script using Windows `cmd`
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -620,7 +620,7 @@ steps:
|
||||
shell: cmd
|
||||
```
|
||||
|
||||
##### Example running a script using PowerShell Core
|
||||
#### Example running a script using PowerShell Core
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -629,7 +629,7 @@ steps:
|
||||
shell: pwsh
|
||||
```
|
||||
|
||||
##### Example running a script using PowerShell Desktop
|
||||
#### Example running a script using PowerShell Desktop
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -638,7 +638,7 @@ steps:
|
||||
shell: powershell
|
||||
```
|
||||
|
||||
##### Example running a python script
|
||||
#### Example running a python script
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -649,11 +649,11 @@ steps:
|
||||
shell: python
|
||||
```
|
||||
|
||||
##### Custom shell
|
||||
#### Custom shell
|
||||
|
||||
You can set the `shell` value to a template string using `command […options] {0} [..more_options]`. {% data variables.product.prodname_dotcom %} interprets the first whitespace-delimited word of the string as the command, and inserts the file name for the temporary script at `{0}`.
|
||||
|
||||
##### Exit codes and error action preference
|
||||
#### Exit codes and error action preference
|
||||
|
||||
For built-in shell keywords, we provide the following defaults that are executed by {% data variables.product.prodname_dotcom %}-hosted runners. You should use these guidelines when running shell scripts.
|
||||
|
||||
@@ -671,11 +671,11 @@ For built-in shell keywords, we provide the following defaults that are executed
|
||||
- There doesn't seem to be a way to fully opt into fail-fast behavior other than writing your script to check each error code and respond accordingly. Because we can't actually provide that behavior by default, you need to write this behavior into your script.
|
||||
- `cmd.exe` will exit with the error level of the last program it executed, and it will return the error code to the runner. This behavior is internally consistent with the previous `sh` and `pwsh` default behavior and is the `cmd.exe` default, so this behavior remains intact.
|
||||
|
||||
#### **`jobs.<job_id>.steps.with`**
|
||||
### `jobs.<job_id>.steps.with`
|
||||
|
||||
A `map` of the input parameters defined by the action. Each input parameter is a key/value pair. Input parameters are set as environment variables. The variable is prefixed with `INPUT_` and converted to upper case.
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
Defines the three input parameters (`first_name`, `middle_name`, and `last_name`) defined by the `hello_world` action. These input variables will be accessible to the `hello-world` action as `INPUT_FIRST_NAME`, `INPUT_MIDDLE_NAME`, and `INPUT_LAST_NAME` environment variables.
|
||||
|
||||
@@ -691,11 +691,11 @@ jobs:
|
||||
last_name: Octocat
|
||||
```
|
||||
|
||||
#### **`jobs.<job_id>.steps.with.args`**
|
||||
### `jobs.<job_id>.steps.with.args`
|
||||
|
||||
A `string` that defines the inputs for a Docker container. {% data variables.product.prodname_dotcom %} passes the `args` to the container's `ENTRYPOINT` when the container starts up. An `array of strings` is not supported by this parameter.
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -714,11 +714,11 @@ The `args` are used in place of the `CMD` instruction in a `Dockerfile`. If you
|
||||
1. Use defaults that allow using the action without specifying any `args`.
|
||||
1. If the action exposes a `--help` flag, or something similar, use that as the default to make your action self-documenting.
|
||||
|
||||
#### **`jobs.<job_id>.steps.with.entrypoint`**
|
||||
### `jobs.<job_id>.steps.with.entrypoint`
|
||||
|
||||
Overrides the Docker `ENTRYPOINT` in the `Dockerfile`, or sets it if one wasn't already specified. Unlike the Docker `ENTRYPOINT` instruction which has a shell and exec form, `entrypoint` keyword accepts only a single string defining the executable to be run.
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@@ -730,7 +730,7 @@ steps:
|
||||
|
||||
The `entrypoint` keyword is meant to be used with Docker container actions, but you can also use it with JavaScript actions that don't define any inputs.
|
||||
|
||||
#### **`jobs.<job_id>.steps.env`**
|
||||
### `jobs.<job_id>.steps.env`
|
||||
|
||||
Sets environment variables for steps to use in the runner environment. You can also set environment variables for the entire workflow or a job. For more information, see [`env`](#env) and [`jobs.<job_id>.env`](#jobsjob_idenv).
|
||||
|
||||
@@ -738,7 +738,7 @@ Sets environment variables for steps to use in the runner environment. You can a
|
||||
|
||||
Public actions may specify expected environment variables in the README file. If you are setting a secret in an environment variable, you must set secrets using the `secrets` context. For more information, see "[Using environment variables](/actions/automating-your-workflow-with-github-actions/using-environment-variables)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -751,23 +751,23 @@ steps:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
#### **`jobs.<job_id>.steps.continue-on-error`**
|
||||
### `jobs.<job_id>.steps.continue-on-error`
|
||||
|
||||
Prevents a job from failing when a step fails. Set to `true` to allow a job to pass when this step fails.
|
||||
|
||||
#### **`jobs.<job_id>.steps.timeout-minutes`**
|
||||
### `jobs.<job_id>.steps.timeout-minutes`
|
||||
|
||||
The maximum number of minutes to run the step before killing the process.
|
||||
|
||||
### **`jobs.<job_id>.timeout-minutes`**
|
||||
### `jobs.<job_id>.timeout-minutes`
|
||||
|
||||
The maximum number of minutes to let a job run before {% data variables.product.prodname_dotcom %} automatically cancels it. Default: 360
|
||||
|
||||
### **`jobs.<job_id>.strategy`**
|
||||
### `jobs.<job_id>.strategy`
|
||||
|
||||
A strategy creates a build matrix for your jobs. You can define different variations of an environment to run each job in.
|
||||
|
||||
#### **`jobs.<job_id>.strategy.matrix`**
|
||||
### `jobs.<job_id>.strategy.matrix`
|
||||
|
||||
You can define a matrix of different job configurations. A matrix allows you to create multiple jobs by performing variable substitution in a single job definition. For example, you can use a matrix to create jobs for more than one supported version of a programming language, operating system, or tool. A matrix reuses the job's configuration and creates a job for each matrix you configure.
|
||||
|
||||
@@ -777,7 +777,7 @@ Each option you define in the `matrix` has a key and value. The keys you define
|
||||
|
||||
The order that you define a `matrix` matters. The first option you define will be the first job that runs in your workflow.
|
||||
|
||||
##### Example running with more than one version of Node.js
|
||||
#### Example running with more than one version of Node.js
|
||||
|
||||
You can specify a matrix by supplying an array for the configuration options. For example, if the runner supports Node.js versions 6, 8, and 10, you could specify an array of those versions in the `matrix`.
|
||||
|
||||
@@ -799,7 +799,7 @@ steps:
|
||||
|
||||
The `setup-node` action is the recommended way to configure a Node.js version when using {% data variables.product.prodname_dotcom %}-hosted runners. For more information, see the [`setup-node`](https://github.com/actions/setup-node) action.
|
||||
|
||||
##### Example running with more than one operating system
|
||||
#### Example running with more than one operating system
|
||||
|
||||
You can create a matrix to run workflows on more than one runner operating system. You can also specify more than one matrix configuration. This example creates a matrix of 6 jobs:
|
||||
|
||||
@@ -824,7 +824,7 @@ steps:
|
||||
|
||||
To find supported configuration options for {% data variables.product.prodname_dotcom %}-hosted runners, see "[Virtual environments for {% data variables.product.prodname_dotcom %}-hosted runners](/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners)."
|
||||
|
||||
##### Example including additional values into combinations
|
||||
#### Example including additional values into combinations
|
||||
|
||||
You can add additional configuration options to a build matrix job that already exists. For example, if you want to use a specific version of `npm` when the job that uses `windows-latest` and version 4 of `node` runs, you can use `include` to specify that additional option.
|
||||
|
||||
@@ -844,7 +844,7 @@ strategy:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
##### Example including new combinations
|
||||
#### Example including new combinations
|
||||
|
||||
You can use `include` to add new jobs to a build matrix. Any unmatched include configurations are added to the matrix. For example, if you want to use `node` version 12 to build on multiple operating systems, but wanted one extra experimental job using node version 13 on Ubuntu, you can use `include` to specify that additional job.
|
||||
|
||||
@@ -862,7 +862,7 @@ strategy:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
##### Example excluding configurations from a matrix
|
||||
#### Example excluding configurations from a matrix
|
||||
|
||||
You can remove a specific configurations defined in the build matrix using the `exclude` option. Using `exclude` removes a job defined by the build matrix. The number of jobs is the cross product of the number of operating systems (`os`) included in the arrays you provide, minus any subtractions (`exclude`).
|
||||
|
||||
@@ -888,40 +888,15 @@ strategy:
|
||||
|
||||
##### Using environment variables in a matrix
|
||||
|
||||
You can add custom environment variables for each test combination by using `include` with `env`. You can then refer to the custom environment variables in a later step.
|
||||
You can add custom environment variables for each test combination by using the `include` key. You can then refer to the custom environment variables in a later step.
|
||||
|
||||
In this example, the matrix entries for `node-version` are each configured to use different values for the `site` and `datacenter` environment variables. The `Echo site details` step then uses {% raw %}`env: ${{ matrix.env }}`{% endraw %} to refer to the custom variables:
|
||||
{% data reusables.github-actions.matrix-variable-example %}
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
name: Node.js CI
|
||||
on: [push]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- node-version: 10.x
|
||||
site: "prod"
|
||||
datacenter: "site-a"
|
||||
- node-version: 12.x
|
||||
site: "dev"
|
||||
datacenter: "site-b"
|
||||
steps:
|
||||
- name: Echo site details
|
||||
env:
|
||||
SITE: ${{ matrix.site }}
|
||||
DATACENTER: ${{ matrix.datacenter }}
|
||||
run: echo $SITE $DATACENTER
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### **`jobs.<job_id>.strategy.fail-fast`**
|
||||
### `jobs.<job_id>.strategy.fail-fast`
|
||||
|
||||
When set to `true`, {% data variables.product.prodname_dotcom %} cancels all in-progress jobs if any `matrix` job fails. Default: `true`
|
||||
|
||||
### **`jobs.<job_id>.strategy.max-parallel`**
|
||||
### `jobs.<job_id>.strategy.max-parallel`
|
||||
|
||||
The maximum number of jobs that can run simultaneously when using a `matrix` job strategy. By default, {% data variables.product.prodname_dotcom %} will maximize the number of jobs run in parallel depending on the available runners on {% data variables.product.prodname_dotcom %}-hosted virtual machines.
|
||||
|
||||
@@ -930,7 +905,7 @@ strategy:
|
||||
max-parallel: 2
|
||||
```
|
||||
|
||||
### **`jobs.<job_id>.continue-on-error`**
|
||||
### `jobs.<job_id>.continue-on-error`
|
||||
|
||||
Prevents a workflow run from failing when a job fails. Set to `true` to allow a workflow run to pass when this job fails.
|
||||
|
||||
@@ -955,7 +930,7 @@ strategy:
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
### **`jobs.<job_id>.container`**
|
||||
### `jobs.<job_id>.container`
|
||||
|
||||
A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.
|
||||
|
||||
@@ -985,16 +960,17 @@ jobs:
|
||||
container: node:10.16-jessie
|
||||
```
|
||||
|
||||
#### **`jobs.<job_id>.container.image`**
|
||||
### `jobs.<job_id>.container.image`
|
||||
|
||||
The Docker image to use as the container to run the action. The value can be the Docker Hub image name or a {% if enterpriseServerVersions contains currentVersion and currentVersion ver_lt "enterprise-server@2.23" %}public{% endif %} registry name.
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
#### **`jobs.<job_id>.container.credentials`**
|
||||
|
||||
### `jobs.<job_id>.container.credentials`
|
||||
|
||||
{% data reusables.actions.registry-credentials %}
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -1007,15 +983,15 @@ container:
|
||||
{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
#### **`jobs.<job_id>.container.env`**
|
||||
### `jobs.<job_id>.container.env`
|
||||
|
||||
Sets a `map` of environment variables in the container.
|
||||
|
||||
#### **`jobs.<job_id>.container.ports`**
|
||||
### `jobs.<job_id>.container.ports`
|
||||
|
||||
Sets an `array` of ports to expose on the container.
|
||||
|
||||
#### **`jobs.<job_id>.container.volumes`**
|
||||
### `jobs.<job_id>.container.volumes`
|
||||
|
||||
Sets an `array` of volumes for the container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
|
||||
|
||||
@@ -1025,7 +1001,7 @@ To specify a volume, you specify the source and destination path:
|
||||
|
||||
The `<source>` is a volume name or an absolute path on the host machine, and `<destinationPath>` is an absolute path in the container.
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
@@ -1034,11 +1010,11 @@ volumes:
|
||||
- /source/directory:/destination/directory
|
||||
```
|
||||
|
||||
#### **`jobs.<job_id>.container.options`**
|
||||
### `jobs.<job_id>.container.options`
|
||||
|
||||
Additional Docker container resource options. For a list of options, see "[`docker create` options](https://docs.docker.com/engine/reference/commandline/create/#options)."
|
||||
|
||||
### **`jobs.<job_id>.services`**
|
||||
### `jobs.<job_id>.services`
|
||||
|
||||
{% data reusables.github-actions.docker-container-os-support %}
|
||||
|
||||
@@ -1068,16 +1044,17 @@ services:
|
||||
- 6379/tcp
|
||||
```
|
||||
|
||||
#### **`jobs.<job_id>.services.<service_id>.image`**
|
||||
### `jobs.<job_id>.services.<service_id>.image`
|
||||
|
||||
The Docker image to use as the service container to run the action. The value can be the Docker Hub image name or a {% if enterpriseServerVersions contains currentVersion and currentVersion ver_lt "enterprise-server@2.23" %}public{% endif %} registry name.
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
#### **`jobs.<job_id>.services.<service_id>.credentials`**
|
||||
|
||||
### `jobs.<job_id>.services.<service_id>.credentials`
|
||||
|
||||
{% data reusables.actions.registry-credentials %}
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
@@ -1096,15 +1073,15 @@ services:
|
||||
{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
#### **`jobs.<job_id>.services.<service_id>.env`**
|
||||
### `jobs.<job_id>.services.<service_id>.env`
|
||||
|
||||
Sets a `map` of environment variables in the service container.
|
||||
|
||||
#### **`jobs.<job_id>.services.<service_id>.ports`**
|
||||
### `jobs.<job_id>.services.<service_id>.ports`
|
||||
|
||||
Sets an `array` of ports to expose on the service container.
|
||||
|
||||
#### **`jobs.<job_id>.services.<service_id>.volumes`**
|
||||
### `jobs.<job_id>.services.<service_id>.volumes`
|
||||
|
||||
Sets an `array` of volumes for the service container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
|
||||
|
||||
@@ -1114,7 +1091,7 @@ To specify a volume, you specify the source and destination path:
|
||||
|
||||
The `<source>` is a volume name or an absolute path on the host machine, and `<destinationPath>` is an absolute path in the container.
|
||||
|
||||
##### Example
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
@@ -1123,7 +1100,7 @@ volumes:
|
||||
- /source/directory:/destination/directory
|
||||
```
|
||||
|
||||
#### **`jobs.<job_id>.services.<service_id>.options`**
|
||||
### `jobs.<job_id>.services.<service_id>.options`
|
||||
|
||||
Additional Docker container resource options. For a list of options, see "[`docker create` options](https://docs.docker.com/engine/reference/commandline/create/#options)."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user