I did only find a way to list all outputs simpler (only incrementing index):
outputs:
j_0_pkg: ${{ steps.update-output.outputs.J_0_pkg }}
j_1_pkg: ${{ steps.update-output.outputs.J_1_pkg }}
...
steps:
- name: just to check all outputs are listed
run: echo total jobs ${{ strategy.job-total }} (from 0 to one less, to 1 here)
# could check automatically of course
- name: set error if tests fail
id: update-output
if: failure()
run: echo J_${{ strategy.job-index }}_pkg='error: ${{ matrix.os }} -- ${{ matrix.pkg }}' >> $GITHUB_OUTPUTS
Note: Using strategy.job-index
in outputs did not work. It reported "Unrecognized named-value: 'strategy'". But I understand that strategy should be available in jobs.<job_id>.outputs.<output_id>
, according to https://docs.github.com/de/actions/reference/contexts-reference#context-availability