2222 outputs :
2323 pr_num : ${{ steps.set-ref.outputs.pr_num }}
2424 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 }}
2528 steps :
2629 - name : Report pending
2730 uses : actions/github-script@v7
@@ -51,10 +54,18 @@ jobs:
5154 name : event_file
5255 path : artifacts/event_file
5356
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+
5465 - name : Try to read PR number
5566 id : set-ref
5667 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:]" )
5869 if [ -z "$pr_num" ] || [ "$pr_num" == "null" ]; then
5970 pr_num=""
6071 fi
@@ -64,11 +75,22 @@ jobs:
6475 ref=${{ github.ref }}
6576 fi
6677
67- action=$(jq -r '.action' artifacts/event_file/event.json)
78+ action=$(jq -r '.action' artifacts/event_file/event.json | tr -cd "[:alpha:]_" )
6879 if [ "$action" == "null" ]; then
6980 action=""
7081 fi
7182
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"
7294 echo "pr_num = $pr_num"
7395
7496 printf "$ref" >> artifacts/ref.txt
98120 cat artifacts/conclusion.txt
99121
100122 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
101126 echo "ref=$ref" >> $GITHUB_OUTPUT
102127
103128 - name : Download and extract parent hardware results
@@ -164,8 +189,8 @@ jobs:
164189 strategy :
165190 fail-fast : false
166191 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) }}
169194 steps :
170195 - name : Report pending
171196 uses : actions/github-script@v7
@@ -211,9 +236,12 @@ jobs:
211236 echo "enabled=$enabled" >> $GITHUB_OUTPUT
212237
213238 # 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.
214240 - name : Checkout repository
215241 if : ${{ steps.check-tests.outputs.enabled == 'true' }}
216242 uses : actions/checkout@v4
243+ with :
244+ ref : ${{ needs.get-artifacts.outputs.base || github.ref }}
217245
218246 - uses : actions/setup-python@v5
219247 if : ${{ steps.check-tests.outputs.enabled == 'true' }}
0 commit comments