Skip to content

Get list of files on pull request merge #26604

Answered by weide-zhou
addietrr asked this question in Actions
Discussion options

You must be logged in to vote

Hi @luchiago ,

The error is due to no json file changes in your pull request, which caused command ’FILES=$(curl … | | grep -E ‘.(json)$’)‘ to be failed.

You can check in this way:

- id: changes
        run: |
          URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
          FILES=$(curl -s -X GET -G $URL | jq -r '.[] | .filename')
          if echo $FILES | grep -q ".json"; then
            echo "json file changed!!"
          else
            echo "no json file changed!!"
          fi

Thanks.

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment