Check Outputted List is Empty?

Anyone know how I can check if an outputted list is empty in GitHub Actions?

I’m using dorny/paths-filter, specifically the use change detection to configure matrix job example under conditional execution .

I was thinking of something like if: join(steps.filter.outputs.packages) and compare the joined result to an empty list, but I’m not sure if that would work or if there is a better way with some kind of hidden .length value

GitHub Actions expressions are fairly limited and I haven’t seen a length function to this day.

However, in this case you can simply compare the output, which is a JSON string, to the JSON string for an empty array:

    needs: changes
    if: needs.changes.outputs.packages != '[]'
1 Like