forked from cloudposse/github-action-matrix-outputs-read
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
32 lines (30 loc) · 1000 Bytes
/
action.yml
File metadata and controls
32 lines (30 loc) · 1000 Bytes
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
name: 'Matrix outputs - read (filtered)'
description: 'Read outputs for matrix. Patched to filter artifact download.'
author: codingsloth@pm.me
branding:
icon: 'chevrons-down'
color: 'white'
inputs:
matrix-step-name:
required: true
description: "Matrix step name"
outputs:
result:
description: "Outputs result"
value: "${{ steps.context.outputs.result }}"
runs:
using: "composite"
steps:
- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2.1.0
with:
version: 1.6
force: 'true'
- uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.matrix-step-name }}-*
- id: context
shell: bash
run: |
result="$(find . -maxdepth 2 -type f -name "${{ inputs.matrix-step-name }}-*" -exec cat {} \; | jq -c --slurp 'map(to_entries | map(.key as $matrix_key | .value | map_values({($matrix_key): .}))) | flatten | reduce .[] as $item ({}; . * $item)' )"
echo "result=${result}" >> $GITHUB_OUTPUT