From 02c9c1a9fac020c3a9301aa0f05aae6403349744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Fri, 13 Nov 2020 10:35:16 +0100 Subject: [PATCH 1/3] add information about conditional in job dependencies --- .../workflow-syntax-for-github-actions.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/content/actions/reference/workflow-syntax-for-github-actions.md b/content/actions/reference/workflow-syntax-for-github-actions.md index 2d4d9a44dfb1..9c3c786675dd 100644 --- a/content/actions/reference/workflow-syntax-for-github-actions.md +++ b/content/actions/reference/workflow-syntax-for-github-actions.md @@ -270,6 +270,20 @@ The jobs in this example run sequentially: 2. `job2` 3. `job3` +Here is an example of using a [conditional statement](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions): + +````yaml +jobs: + job1: + job2: + needs: job1 + job3: + if: always() + needs: [job1, job2] +``` + +``job3` will run after `job1` and `job2` whether `job1` and `job2` are successful or not. + ### **`jobs..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. From 6928609c0f6ea00f816e59cb5e5af5ca8a684aac Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Mon, 14 Dec 2020 14:35:16 +1000 Subject: [PATCH 2/3] Edits, link fixes, and layout changes --- .../reference/workflow-syntax-for-github-actions.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/actions/reference/workflow-syntax-for-github-actions.md b/content/actions/reference/workflow-syntax-for-github-actions.md index a7d5aa603320..ecd52259f558 100644 --- a/content/actions/reference/workflow-syntax-for-github-actions.md +++ b/content/actions/reference/workflow-syntax-for-github-actions.md @@ -249,9 +249,9 @@ The name of the job displayed on {% data variables.product.prodname_dotcom %}. ### `jobs..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,9 +270,9 @@ The jobs in this example run sequentially: 2. `job2` 3. `job3` -Here is an example of using a [conditional statement](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions): +#### Example not requiring dependent jobs to be successful -````yaml +```yaml jobs: job1: job2: @@ -282,7 +282,7 @@ jobs: needs: [job1, job2] ``` -``job3` will run after `job1` and `job2` whether `job1` and `job2` are successful or not. +In this example, `job3` uses the `always()` conditional expression so it always runs after `job1` and `job2` completes, whether `job1` and `job2` are successful or not. For more information, see "[Context and expression syntax](/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions)." ### `jobs..runs-on` From 3cc8916e512447ad744010ef44ff2145b61fe7a1 Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Mon, 14 Dec 2020 15:01:16 +1000 Subject: [PATCH 3/3] Update content/actions/reference/workflow-syntax-for-github-actions.md --- content/actions/reference/workflow-syntax-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/reference/workflow-syntax-for-github-actions.md b/content/actions/reference/workflow-syntax-for-github-actions.md index ecd52259f558..863f1adadae3 100644 --- a/content/actions/reference/workflow-syntax-for-github-actions.md +++ b/content/actions/reference/workflow-syntax-for-github-actions.md @@ -282,7 +282,7 @@ jobs: needs: [job1, job2] ``` -In this example, `job3` uses the `always()` conditional expression so it always runs after `job1` and `job2` completes, whether `job1` and `job2` are successful or not. For more information, see "[Context and expression syntax](/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions)." +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..runs-on`