зеркало из https://github.com/github/docs.git
Add `needs:` syntax example using `always()` condition (#1307)
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
This commit is contained in:
Родитель
c25bd6b58e
Коммит
cecda2a163
|
@ -249,9 +249,9 @@ The name of the job displayed on {% data variables.product.prodname_dotcom %}.
|
|||
|
||||
### `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.
|
||||
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 expression that causes the job to continue.
|
||||
|
||||
#### Example
|
||||
#### Example requiring dependent jobs to be successful
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
|
@ -270,6 +270,20 @@ The jobs in this example run sequentially:
|
|||
2. `job2`
|
||||
3. `job3`
|
||||
|
||||
#### Example not requiring dependent jobs to be successful
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
job1:
|
||||
job2:
|
||||
needs: job1
|
||||
job3:
|
||||
if: always()
|
||||
needs: [job1, job2]
|
||||
```
|
||||
|
||||
In this example, `job3` uses the `always()` conditional expression so that it always runs after `job1` and `job2` have completed, regardless of whether they were successful. For more information, see "[Context and expression syntax](/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions)."
|
||||
|
||||
### `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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче