Update paths-filter base comparison to use pull request base SHA or p… #6
Workflow file for this run
This file contains hidden or 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: Tests | |
| on: | |
| pull_request: | |
| push: | |
| jobs: | |
| # This job checks if there are any changes to important code files. Specifically | |
| # - Code/** | |
| # - tests/** | |
| # - .github/** | |
| # If there are any changes, the job will set the run_full_tests output to true. | |
| # If there are no changes, the job will set the run_full_tests output to false. | |
| check-for-changes-in-important-files: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_full_tests: ${{ steps.set-outputs.outputs.run_full_tests }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| base: ${{ github.event.pull_request.base.sha || github.event.before }} # Compare against base branch or previous commit | |
| filters: | | |
| relevant: | |
| - 'Code/**' | |
| - 'tests/**' | |
| - '.github/**' | |
| - name: Set output | |
| id: set-outputs | |
| run: | | |
| if [ "${{ steps.filter.outputs.relevant }}" = "true" ]; then | |
| echo "run_full_tests=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "run_full_tests=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| # Dummy job that always passes when no code/tests changed | |
| skip-tests: | |
| needs: check-for-changes-in-important-files | |
| if: ${{ needs.check-for-changes-in-important-files.outputs.run_full_tests == 'false' }} | |
| uses: ./.github/workflows/skip_tests.yml | |
| # Call Ubuntu testing workflow | |
| test-ubuntu: | |
| needs: check-for-changes-in-important-files | |
| if: ${{ needs.check-for-changes-in-important-files.outputs.run_full_tests == 'true' }} | |
| uses: ./.github/workflows/test_ubuntu.yml | |
| # Call macOS testing workflow | |
| test-macos: | |
| needs: check-for-changes-in-important-files | |
| if: ${{ needs.check-for-changes-in-important-files.outputs.run_full_tests == 'true' }} | |
| uses: ./.github/workflows/test_macos.yml |