It's possible to not run every version in the matrix?

I want to not run every version of python settled at the matrix depending on the file that was modified on the pull request. This could be done?

Hi @luchiago , 

There is a new function fromJson() to dynamicly set matrix setting.

You could add another job to get the changed file on the pull request and then set matrix setting depending on it. 

There is a previous ticket for finding pull request file changes : 

Then you could follow my example workflow to set python version in matrix .

      matrix: ${{ steps.changes.outputs.matrix }}
   runs-on: ubuntu-latest
     - id: changes
       ## set matrix value based on file changes
       run: |
         ....... // write your script to get file change then set matrix value
         echo "::set-output name=matrix::{\"include\":[{\"python\":\"3.5\" },{\"python\":\"3.7\"}]}"
    needs: [getchange]
    runs-on: ubuntu-latest
      matrix: ${{ fromJson(needs.getchange.outputs.matrix) }}

    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python }}
      uses: actions/setup-python@v1
        python-version: ${{ matrix.python }}
1 Like

Thanks, @yanjingzhu, I will implement your suggestion and see if fits the project and give you feedback about it.

Hi @luchiago,
Does fromJson() function work for you? Is there any other questions you need help?

1 Like

Yes, it did. Thank you so much for your help. I don’t have any other questions.