How to avoid duplication of file lists in Azure DevOps / GitHub pipelines?
Suppose I have the following YAML file:
name: Build
on:
push:
branches: [ master ]
paths:
- 'SRC/define.inc'
- 'SRC/SrvMain.pas'
- 'SRC/Tiny.dpr'
- 'SRC/xBase.pas'
pull_request:
branches: [ master ]
paths:
- 'SRC/define.inc'
- 'SRC/SrvMain.pas'
- 'SRC/Tiny.dpr'
- 'SRC/xBase.pas'
workflow_dispatch:
jobs:
...skipped remaining lines...
(I'm using this pipeline for the TinyWeb repository on GitHub)
As you see, the list of files under the paths: section repeats for the "push" and "pull_request" sections. How can I define a list of files just once, so I would not need to copy it to each of the sections, but only add a reference to the list variable? I've tried to define the list using the variables: keyword and then reference the list as ${{ variables.my_variable_name }}, but it didn't work. I tried multiple variants to no avail.
Please give an example of the YAML file where I can define the list of files once and then use it from multiple sections under on:.