Merge branch 'main' into jules-4795
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
title: Workflow syntax for GitHub Actions
|
||||
shortTitle: Workflow syntax
|
||||
intro: A workflow is a configurable automated process made up of one or more jobs. You must create a YAML file to define your workflow configuration.
|
||||
product: '{% data reusables.gated-features.actions %}'
|
||||
redirect_from:
|
||||
- /articles/workflow-syntax-for-github-actions
|
||||
- /github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
|
||||
@@ -12,10 +11,12 @@ versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
---
|
||||
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
{% data reusables.actions.ae-beta %}
|
||||
|
||||
## About YAML syntax for workflows
|
||||
|
||||
@@ -183,7 +184,7 @@ Diffs are limited to 300 files. If there are files changed that aren't matched i
|
||||
|
||||
For more information, see "[About comparing branches in pull requests](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-comparing-branches-in-pull-requests)."
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
## `on.workflow_call.inputs`
|
||||
|
||||
When using the `workflow_call` keyword, you can optionally specify inputs that are passed to the called workflow from the caller workflow. Inputs for reusable workflows are specified with the same format as action inputs. For more information about inputs, see "[Metadata syntax for GitHub Actions](/actions/creating-actions/metadata-syntax-for-github-actions#inputs)." For more information about the `workflow_call` keyword, see "[Events that trigger workflows](/actions/learn-github-actions/events-that-trigger-workflows#workflow-reuse-events)."
|
||||
@@ -290,7 +291,7 @@ The triggered workflow receives the inputs in the `github.event.inputs` context.
|
||||
|
||||
For more information about cron syntax, see "[Events that trigger workflows](/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events)."
|
||||
|
||||
{% ifversion fpt or ghes > 3.1 or ghae-next %}
|
||||
{% ifversion fpt or ghes > 3.1 or ghae-next or ghec %}
|
||||
## `permissions`
|
||||
|
||||
You can modify the default permissions granted to the `GITHUB_TOKEN`, adding or removing access as required, so that you only allow the minimum required access. For more information, see "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token)."
|
||||
@@ -350,7 +351,7 @@ defaults:
|
||||
working-directory: scripts
|
||||
```
|
||||
|
||||
{% ifversion fpt or ghae-next or ghes > 3.1 %}
|
||||
{% ifversion fpt or ghae-next or ghes > 3.1 or ghec %}
|
||||
## `concurrency`
|
||||
|
||||
Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can only use the [`github` context](/actions/learn-github-actions/contexts#github-context). For more information about expressions, see "[Expressions](/actions/learn-github-actions/expressions)."
|
||||
@@ -368,14 +369,16 @@ Each job runs in a runner 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](/rest/reference/actions#workflow-jobs)."
|
||||
If you need to find the unique identifier of a job running in a workflow run, you can use the {% ifversion fpt or ghec %}{% data variables.product.prodname_dotcom %}{% else %}{% data variables.product.product_name %}{% endif %} API. For more information, see "[Workflow Jobs](/rest/reference/actions#workflow-jobs)."
|
||||
|
||||
## `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 `_`.
|
||||
Create an identifier for your job by giving it a unique name. 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 `_`.
|
||||
|
||||
### Example
|
||||
|
||||
In this example, two jobs have been created, and their `job_id` values are `my_first_job` and `my_second_job`.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
my_first_job:
|
||||
@@ -476,7 +479,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)."
|
||||
|
||||
{% ifversion fpt or ghes > 3.1 or ghae-next %}
|
||||
{% ifversion fpt or ghes > 3.1 or ghae-next or ghec %}
|
||||
## `jobs.<job_id>.permissions`
|
||||
|
||||
You can modify the default permissions granted to the `GITHUB_TOKEN`, adding or removing access as required, so that you only allow the minimum required access. For more information, see "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token)."
|
||||
@@ -504,7 +507,7 @@ jobs:
|
||||
```
|
||||
{% endif %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.0 or ghae %}
|
||||
{% ifversion fpt or ghes > 3.0 or ghae or ghec %}
|
||||
## `jobs.<job_id>.environment`
|
||||
|
||||
The environment that the job references. All environment protection rules must pass before a job referencing the environment is sent to a runner. For more information, see "[Using environments for deployment](/actions/deployment/using-environments-for-deployment)."
|
||||
@@ -539,7 +542,7 @@ environment:
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% ifversion fpt or ghae-next or ghes > 3.1 %}
|
||||
{% ifversion fpt or ghae-next or ghes > 3.1 or ghec %}
|
||||
## `jobs.<job_id>.concurrency`
|
||||
|
||||
{% note %}
|
||||
@@ -791,7 +794,7 @@ jobs:
|
||||
uses: docker://alpine:3.8
|
||||
```
|
||||
|
||||
{% ifversion fpt %}
|
||||
{% ifversion fpt or ghec %}
|
||||
#### Example: Using the {% data variables.product.prodname_registry %} {% data variables.product.prodname_container_registry %}
|
||||
|
||||
`docker://{host}/{image}:{tag}`
|
||||
@@ -877,7 +880,7 @@ Using the `working-directory` keyword, you can specify the working directory of
|
||||
|
||||
### 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. The shell command that is run internally executes a temporary file that contains the commands specifed in the `run` keyword.
|
||||
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. The shell command that is run internally executes a temporary file that contains the commands specified in the `run` keyword.
|
||||
|
||||
| Supported platform | `shell` parameter | Description | Command run internally |
|
||||
|--------------------|-------------------|-------------|------------------------|
|
||||
@@ -1273,7 +1276,7 @@ jobs:
|
||||
|
||||
The Docker image to use as the container to run the action. The value can be the Docker Hub image name or a {% ifversion ghes < 3.0 %}public{% endif %} registry name.
|
||||
|
||||
{% ifversion fpt or ghes > 2.22 or ghae %}
|
||||
{% ifversion fpt or ghes > 2.22 or ghae or ghec %}
|
||||
|
||||
## `jobs.<job_id>.container.credentials`
|
||||
|
||||
@@ -1363,7 +1366,7 @@ services:
|
||||
|
||||
The Docker image to use as the service container to run the action. The value can be the Docker Hub image name or a {% ifversion ghes < 3.0 %}public{% endif %} registry name.
|
||||
|
||||
{% ifversion fpt or ghes > 2.22 or ghae %}
|
||||
{% ifversion fpt or ghes > 2.22 or ghae or ghec %}
|
||||
|
||||
## `jobs.<job_id>.services.<service_id>.credentials`
|
||||
|
||||
@@ -1425,7 +1428,7 @@ Additional Docker container resource options. For a list of options, see "[`dock
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 %}
|
||||
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
|
||||
## `jobs.<job_id>.uses`
|
||||
|
||||
The location and version of a reusable workflow file to run as a job.
|
||||
|
||||
Reference in New Issue
Block a user