Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check which tests to run | |
env: | |
WEAVE_QUERY_PATHS: 'weave_query/' | |
CORE_INTEGRATION_PATHS: 'weave-js/ weave_query/' | |
# Everything else is implicitly trace server | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
weave_query_tests: ${{ steps.weave_query.outputs.run_tests }} | |
core_integration_tests: ${{ steps.core_integration.outputs.run_tests }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
ref: ${{ github.head_ref }} | |
- run: git fetch origin ${{ github.base_ref }} | |
- run: | | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
base_sha=$(git rev-parse origin/${{ github.base_ref }}) | |
head_sha=$(git rev-parse HEAD) | |
changed_files=$(git diff --name-only $base_sha $head_sha) | |
else | |
changed_files=$(git diff --name-only HEAD^) | |
fi | |
- id: weave_query | |
run: | | |
for path in ${{ env.WEAVE_QUERY_PATHS }}; do | |
if echo "$changed_files" | grep -q "$path"; then | |
echo "run_tests=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
done | |
echo "run_tests=false" >> $GITHUB_OUTPUT | |
- id: core_integration | |
run: | | |
for path in ${{ env.CORE_INTEGRATION_PATHS }}; do | |
if echo "$changed_files" | grep -q "$path"; then | |
echo "run_tests=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
done | |
echo "run_tests=false" >> $GITHUB_OUTPUT |