From 7df08bfb018e188a4e15b083a1e3deef8bce34d6 Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Sat, 3 Dec 2022 03:21:26 -0700 Subject: [PATCH 1/8] callout missing job and matrix functionality in if conditional --- .../section-using-conditions-to-control-job-execution.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index 320d0c311adc..605d3753a0c0 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -2,6 +2,12 @@ You can use the `jobs..if` conditional to prevent a job from running unl {% data reusables.actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)." +{% note %} + +**Note:** The `jobs` and `matrix` contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ````.` error. Many of these errors can be quickly fixed by switching your expression to the `needs` context instead. + +{% endnote %} + ### Example: Only run job for specific repository This example uses `if` to control when the `production-deploy` job can run. It will only run if the repository is named `octo-repo-prod` and is within the `octo-org` organization. Otherwise, the job will be marked as _skipped_. From 5f543fa7f762a470c5d0cc3c395e86c553255e23 Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Sat, 3 Dec 2022 03:33:56 -0700 Subject: [PATCH 2/8] use single quote instead of backtick for error text --- .../jobs/section-using-conditions-to-control-job-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index 605d3753a0c0..069853cc0253 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -4,7 +4,7 @@ You can use the `jobs..if` conditional to prevent a job from running unl {% note %} -**Note:** The `jobs` and `matrix` contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ````.` error. Many of these errors can be quickly fixed by switching your expression to the `needs` context instead. +**Note:** The `jobs` and `matrix` contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. Many of these errors can be quickly fixed by switching your expression to the `needs` context instead. {% endnote %} From 63d72f6b9c15fb5f3b2068e21e965cf8f853d298 Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Sat, 3 Dec 2022 03:44:58 -0700 Subject: [PATCH 3/8] Add link to context availability topic --- .../jobs/section-using-conditions-to-control-job-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index 069853cc0253..f3c183749cbd 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -4,7 +4,7 @@ You can use the `jobs..if` conditional to prevent a job from running unl {% note %} -**Note:** The `jobs` and `matrix` contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. Many of these errors can be quickly fixed by switching your expression to the `needs` context instead. +**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability). {% endnote %} From 93c26518ce9fc8197e0cc64f792db335fb3d9108 Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Sat, 3 Dec 2022 04:00:08 -0700 Subject: [PATCH 4/8] fix URLs must not contain hard-coded domain name lint error? --- .../jobs/section-using-conditions-to-control-job-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index f3c183749cbd..49a0bf98d505 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -4,7 +4,7 @@ You can use the `jobs..if` conditional to prevent a job from running unl {% note %} -**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability). +**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](/docs/actions/learn-github-actions/contexts#context-availability). {% endnote %} From f7df618d3cdbbc11d8a152eebb887895734f4655 Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Sat, 3 Dec 2022 04:10:04 -0700 Subject: [PATCH 5/8] drop leading /docs ? --- .../jobs/section-using-conditions-to-control-job-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index 49a0bf98d505..995d8ec49bb7 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -4,7 +4,7 @@ You can use the `jobs..if` conditional to prevent a job from running unl {% note %} -**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](/docs/actions/learn-github-actions/contexts#context-availability). +**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](/actions/learn-github-actions/contexts#context-availability). {% endnote %} From f2472195b72720c70951373e6a5e40841ebf03ed Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Sat, 3 Dec 2022 04:27:10 -0700 Subject: [PATCH 6/8] remove empty space to trigger new run after timeout fail --- .../jobs/section-using-conditions-to-control-job-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index 995d8ec49bb7..92bcbf782ded 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -4,7 +4,7 @@ You can use the `jobs..if` conditional to prevent a job from running unl {% note %} -**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](/actions/learn-github-actions/contexts#context-availability). +**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](/actions/learn-github-actions/contexts#context-availability). {% endnote %} From 0bf6b032fcccf32e4fb7e2e2f5fdfdc2a39f79f4 Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Sat, 3 Dec 2022 04:52:23 -0700 Subject: [PATCH 7/8] update link style --- .../jobs/section-using-conditions-to-control-job-execution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index 92bcbf782ded..07f125d6fc72 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -4,7 +4,7 @@ You can use the `jobs..if` conditional to prevent a job from running unl {% note %} -**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more details, review the [context availability topic](/actions/learn-github-actions/contexts#context-availability). +**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more information, see "[context availability](/actions/learn-github-actions/contexts#context-availability)". {% endnote %} From f13e720250d28a247c7873fada9d23ca49e9cc7b Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Tue, 6 Dec 2022 15:37:57 +1000 Subject: [PATCH 8/8] Add link to Context availability article in 'if' keys --- .../using-workflows/workflow-syntax-for-github-actions.md | 2 +- data/reusables/actions/if-supported-contexts.md | 1 + .../section-using-conditions-to-control-job-execution.md | 8 +------- 3 files changed, 3 insertions(+), 8 deletions(-) create mode 100644 data/reusables/actions/if-supported-contexts.md diff --git a/content/actions/using-workflows/workflow-syntax-for-github-actions.md b/content/actions/using-workflows/workflow-syntax-for-github-actions.md index 4969f6b53edc..0fa463a68cc7 100644 --- a/content/actions/using-workflows/workflow-syntax-for-github-actions.md +++ b/content/actions/using-workflows/workflow-syntax-for-github-actions.md @@ -320,7 +320,7 @@ A unique identifier for the step. You can use the `id` to reference the step in ### `jobs..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. +You can use the `if` conditional to prevent a step from running unless a condition is met. {% data reusables.actions.if-supported-contexts %} {% data reusables.actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)." diff --git a/data/reusables/actions/if-supported-contexts.md b/data/reusables/actions/if-supported-contexts.md new file mode 100644 index 000000000000..6b7c41c0a34f --- /dev/null +++ b/data/reusables/actions/if-supported-contexts.md @@ -0,0 +1 @@ +You can use any supported context and expression to create a conditional. For more information on which contexts are supported in this key, see "[Context availability](/actions/learn-github-actions/contexts#context-availability)." \ No newline at end of file diff --git a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md index 07f125d6fc72..1193172cdd1a 100644 --- a/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md +++ b/data/reusables/actions/jobs/section-using-conditions-to-control-job-execution.md @@ -1,13 +1,7 @@ -You can use the `jobs..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. +You can use the `jobs..if` conditional to prevent a job from running unless a condition is met. {% data reusables.actions.if-supported-contexts %} {% data reusables.actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)." -{% note %} - -**Note:** Some contexts are not available for use in the `jobs..if` conditional. If you attempt to use a context which is not available you will receive an `Unrecognized named-value: ''.` error. For more information, see "[context availability](/actions/learn-github-actions/contexts#context-availability)". - -{% endnote %} - ### Example: Only run job for specific repository This example uses `if` to control when the `production-deploy` job can run. It will only run if the repository is named `octo-repo-prod` and is within the `octo-org` organization. Otherwise, the job will be marked as _skipped_.