Skip to content

Commit 9b7f600

Browse files
drielenrCopilot
andauthored
Restore snapshot conditionals section to use-custom-images.md (#61507)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 506f713 commit 9b7f600

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

content/actions/how-tos/manage-runners/larger-runners/use-custom-images.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,24 @@ jobs:
9494
# Add any steps to download and setup any dependencies here
9595
```
9696

97+
### Conditionals
98+
99+
The `snapshot` keyword supports conditional execution using the `if` keyword around the snapshot mapping. You can use conditions to control when an image snapshot is created. For example, the following job skips image creation for tag builds.
100+
101+
```yaml
102+
jobs:
103+
build:
104+
runs-on: my-image-generation-runner
105+
snapshot:
106+
if: {% raw %}${{ ! startsWith(github.ref, 'refs/tags/') }}{% endraw %}
107+
image-name: my-custom-image
108+
version: 2.*
109+
steps:
110+
# Add any steps to download and setup any dependencies here
111+
```
112+
113+
For more information about the `if` keyword, see [AUTOTITLE](/actions/how-tos/write-workflows/choose-when-workflows-run/control-jobs-with-conditions).
114+
97115
## Versioning
98116

99117
When you generate custom images, {% data variables.product.github %} automatically assigns version numbers to help you manage updates and track image history.

0 commit comments

Comments
 (0)