Closed JacobJaffe closed 4 years ago
Improves our workflows so we can require all tests on PRs, but they will auto succeed if no changes detected. We can adjust what "changes detected" means as we see fit.
URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files" FILES=$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s -X GET -G $URL | jq -r '.[] | .filename') echo "Checking Files: $FILES" REGEX="\.js\|\.jsx\|\.ts\|\.tsx" if echo $FILES | grep -q $REGEX; then echo "Detected iOS changes. Running tests!" echo "Changed Files:" echo $FILES | grep $REGEX echo "::set-env name=RUN_TESTS::1" else echo "No iOS changed detected. Skipping tests." echo "::set-env name=RUN_TESTS::0" fi
--paths
RUN_TESTS
step 4 is a little tedious, but it seems that there is no way to succeed a workflow early, only fail it.
change files matching the regex, make a PR with this code
Improves our workflows so we can require all tests on PRs, but they will auto succeed if no changes detected. We can adjust what "changes detected" means as we see fit.
How this works:
--paths
, except this happens within the job.RUN_TESTS
commandRUN_TESTS
step 4 is a little tedious, but it seems that there is no way to succeed a workflow early, only fail it.
How to test this:
change files matching the regex, make a PR with this code