22
22
outputs :
23
23
pr_num : ${{ steps.set-ref.outputs.pr_num }}
24
24
ref : ${{ steps.set-ref.outputs.ref }}
25
+ base : ${{ steps.set-ref.outputs.base }}
26
+ targets : ${{ steps.set-ref.outputs.targets }}
27
+ types : ${{ steps.set-ref.outputs.types }}
25
28
steps :
26
29
- name : Report pending
27
30
uses : actions/github-script@v7
@@ -51,10 +54,18 @@ jobs:
51
54
name : event_file
52
55
path : artifacts/event_file
53
56
57
+ - name : Download and extract matrix info
58
+ uses : actions/download-artifact@v4
59
+ with :
60
+ github-token : ${{ secrets.GITHUB_TOKEN }}
61
+ run-id : ${{ github.event.workflow_run.id }}
62
+ name : matrix_info
63
+ path : artifacts/matrix_info
64
+
54
65
- name : Try to read PR number
55
66
id : set-ref
56
67
run : |
57
- pr_num=$(jq -r '.pull_request.number' artifacts/event_file/event.json)
68
+ pr_num=$(jq -r '.pull_request.number' artifacts/event_file/event.json | tr -cd "[:digit:]" )
58
69
if [ -z "$pr_num" ] || [ "$pr_num" == "null" ]; then
59
70
pr_num=""
60
71
fi
@@ -64,11 +75,22 @@ jobs:
64
75
ref=${{ github.ref }}
65
76
fi
66
77
67
- action=$(jq -r '.action' artifacts/event_file/event.json)
78
+ action=$(jq -r '.action' artifacts/event_file/event.json | tr -cd "[:alpha:]_" )
68
79
if [ "$action" == "null" ]; then
69
80
action=""
70
81
fi
71
82
83
+ base=$(jq -r '.pull_request.base.ref' artifacts/event_file/event.json | tr -cd "[:alnum:]/_.-")
84
+ if [ -z "$base" ] || [ "$base" == "null" ]; then
85
+ base=${{ github.ref }}
86
+ fi
87
+
88
+ types=$(cat artifacts/matrix_info/wokwi_types.txt | tr -cd "[:alpha:],[]'")
89
+ targets=$(cat artifacts/matrix_info/targets.txt | tr -cd "[:alnum:],[]'")
90
+
91
+ echo "base = $base"
92
+ echo "targets = $targets"
93
+ echo "types = $types"
72
94
echo "pr_num = $pr_num"
73
95
74
96
printf "$ref" >> artifacts/ref.txt
98
120
cat artifacts/conclusion.txt
99
121
100
122
echo "pr_num=$pr_num" >> $GITHUB_OUTPUT
123
+ echo "base=$base" >> $GITHUB_OUTPUT
124
+ echo "targets=$targets" >> $GITHUB_OUTPUT
125
+ echo "types=$types" >> $GITHUB_OUTPUT
101
126
echo "ref=$ref" >> $GITHUB_OUTPUT
102
127
103
128
- name : Download and extract parent hardware results
@@ -164,8 +189,8 @@ jobs:
164
189
strategy :
165
190
fail-fast : false
166
191
matrix :
167
- type : ['validation']
168
- chip : ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
192
+ type : ${{ fromJson(needs.get-artifacts.outputs.types) }}
193
+ chip : ${{ fromJson(needs.get-artifacts.outputs.targets) }}
169
194
steps :
170
195
- name : Report pending
171
196
uses : actions/github-script@v7
@@ -211,9 +236,12 @@ jobs:
211
236
echo "enabled=$enabled" >> $GITHUB_OUTPUT
212
237
213
238
# Note that changes to the workflows and tests will only be picked up after the PR is merged
239
+ # DO NOT CHECKOUT THE USER'S REPOSITORY IN THIS WORKFLOW. IT HAS HIGH SECURITY RISKS.
214
240
- name : Checkout repository
215
241
if : ${{ steps.check-tests.outputs.enabled == 'true' }}
216
242
uses : actions/checkout@v4
243
+ with :
244
+ ref : ${{ needs.get-artifacts.outputs.base || github.ref }}
217
245
218
246
- uses : actions/setup-python@v5
219
247
if : ${{ steps.check-tests.outputs.enabled == 'true' }}
0 commit comments