Referecing an element from array in .yml

Hello,

I’m trying to get commit message in “on push” workflow.

I assumed I could just get it by using something like

- run: echo ${{ github.event.push.commits.0.message }}

Sadly, I can’t, because .0 to get first item from array is invalid syntax.

How can I do this?

- run: echo "${{ github.event.commits[0].message }}"
2 Likes