how can I output the array of labels associated to a PR. an echo gives me Array
as a result:
name: An action test
on:
pull_request:
branches: ['master']
jobs:
generate-matrix:
runs-on: [Linux]
container: xxx
steps:
- name: test
run: echo ${{ github.event.pull_request.labels.*.name }}
You can use toJSON function, like this:
name: An action test
on:
pull_request:
branches: ['master']
jobs:
generate-matrix:
runs-on: [Linux]
container: xxx
steps:
- name: test
run: echo "${{ toJSON(github.event.pull_request.labels.*.name) }}"
You should get a JSON array like this:
[
label1,
label2
]
If you want to use this array in a shell command, you can have a look to this post: GitHub Actions: How to pass toJSON() result to shell commands