Skip to content

Commit

Permalink
Set python version based on file change
Browse files Browse the repository at this point in the history
  • Loading branch information
luchiago committed May 15, 2020
1 parent 606eb20 commit 134d0ab
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/sherlock_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 134d0ab

Please sign in to comment.