-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
71 lines (70 loc) · 2.41 KB
/
action.yml
File metadata and controls
71 lines (70 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
name: Generate Deployment Matrix
description: |
Generates a deployment matrix based on changed files (using a pre-defined filter). For each
matched path it will try to lookup the key, or default to the provided default
key.
inputs:
filter-file:
description: Path to the filter file
required: true
changes-override:
description: |
Override the changes filter and provide your own set of paths (comma separated). If you
provide the magic value `_all_`, it'll use all the paths from the filter file.
required: false
default-key:
description: Default key (fallback value if no key is provided for a path)
required: false
default: Default
output-key-name:
description: Name for the output key (defaults to `environment`)
required: false
default: environment
outputs:
matrix:
description: List of combinations of paths & keys
value: ${{ steps.matrix-generator.outputs.matrix }}
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Simplify filter file
shell: bash
run: |
${{ github.action_path }}/scripts/simplify-filter-file.sh \
${{ inputs.filter-file }} \
/tmp/simple-path-filters.yaml
# Collect changed paths
- name: Collect changes
if: "${{ inputs.changes-override == '' }}"
id: filtered
uses: dorny/paths-filter@v3
with:
filters: /tmp/simple-path-filters.yaml
- name: Collect changes
if: "${{ inputs.changes-override == '_all_' }}"
id: all
shell: bash
run: |
echo "changes=`${{ github.action_path }}/scripts/generate-all-keys.sh \
/tmp/simple-path-filters.yaml`" >> "$GITHUB_OUTPUT"
- name: Collect changes
id: custom
shell: bash
run: |
echo "changes=`${{ github.action_path }}/scripts/process-manual-keys.sh \
'${{ inputs.changes-override }}'`" >> "$GITHUB_OUTPUT"
# Post process into actual matrix
- name: Generate Matrix
id: matrix-generator
shell: bash
run: |
CHANGED_PATHS='${{ steps.filtered.outputs.changes || steps.all.outputs.changes || steps.custom.outputs.changes }}'
echo "matrix=`${{ github.action_path }}/scripts/generate-matrix.sh \
<(echo $CHANGED_PATHS) \
${{ inputs.filter-file }} \
${{ inputs.output-key-name }} \
${{ inputs.default-key }}
`" >> "$GITHUB_OUTPUT"