From 134d0ab464b7d3abbd2982ffb7bf3495f7c7b230 Mon Sep 17 00:00:00 2001 From: Lucas Hiago Date: Mon, 11 May 2020 21:45:11 -0300 Subject: [PATCH] Set python version based on file change --- .github/workflows/sherlock_test.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sherlock_test.yml b/.github/workflows/sherlock_test.yml index 24ce8992..5d7bf9fa 100644 --- a/.github/workflows/sherlock_test.yml +++ b/.github/workflows/sherlock_test.yml @@ -7,12 +7,26 @@ on: branches: [ master ] jobs: + getchange: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.changes.outputs.matrix }} + steps: + - id: changes + run: | + URL="https://api.github.com/repos/sherlock-project/sherlock/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 "::set-output name=matrix::{\"include\":[{\"python\":\"3.8\"}]}" + else + echo "::set-output name=matrix::{\"include\":[{\"python\":\"3.6\" },{\"python\":\"3.7\"},{\"python\":\"3.8\"}]}" + fi build: - + needs: getchange runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: ${{fromJson(needs.getchange.outputs.matrix)}} steps: - uses: actions/checkout@v2