diff --git a/.github/workflows/cli-pr-checks.yml b/.github/workflows/cli-pr-checks.yml index 2265efec999..62efec1a63e 100644 --- a/.github/workflows/cli-pr-checks.yml +++ b/.github/workflows/cli-pr-checks.yml @@ -10,6 +10,30 @@ permissions: issues: write jobs: + # Check what files changed to determine which jobs to skip + changes: + runs-on: ubuntu-latest + outputs: + docs-only: ${{ steps.check-changes.outputs.docs-only }} + steps: + - uses: actions/checkout@v5 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + docs: + - 'docs/**' + non-docs: + - '!docs/**' + - name: Check if only docs changed + id: check-changes + run: | + if [[ "${{ steps.filter.outputs.docs }}" == "true" && "${{ steps.filter.outputs.non-docs }}" == "false" ]]; then + echo "docs-only=true" >> $GITHUB_OUTPUT + else + echo "docs-only=false" >> $GITHUB_OUTPUT + fi + track-rerun: runs-on: ubuntu-latest if: github.run_attempt > 1 @@ -55,6 +79,8 @@ jobs: npm run lint test: + needs: changes + if: needs.changes.outputs.docs-only != 'true' strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -126,6 +152,7 @@ jobs: if: always() runs-on: ubuntu-latest needs: + - changes - lint - test @@ -133,4 +160,5 @@ jobs: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: + allowed-skips: test jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 422759fa781..2b589c7608e 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -11,6 +11,30 @@ on: - main jobs: + # Check what files changed to determine which jobs to skip + changes: + runs-on: ubuntu-latest + outputs: + docs-only: ${{ steps.check-changes.outputs.docs-only }} + steps: + - uses: actions/checkout@v5 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + docs: + - 'docs/**' + non-docs: + - '!docs/**' + - name: Check if only docs changed + id: check-changes + run: | + if [[ "${{ steps.filter.outputs.docs }}" == "true" && "${{ steps.filter.outputs.non-docs }}" == "false" ]]; then + echo "docs-only=true" >> $GITHUB_OUTPUT + else + echo "docs-only=false" >> $GITHUB_OUTPUT + fi + track-rerun: runs-on: ubuntu-latest if: github.run_attempt > 1 @@ -89,6 +113,8 @@ jobs: INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} gui-checks: + needs: changes + if: needs.changes.outputs.docs-only != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -119,6 +145,8 @@ jobs: npm test binary-checks: + needs: changes + if: needs.changes.outputs.docs-only != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -331,6 +359,8 @@ jobs: is_fork: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} jetbrains-tests: + needs: changes + if: needs.changes.outputs.docs-only != 'true' runs-on: ubuntu-latest timeout-minutes: 15 steps: @@ -349,6 +379,7 @@ jobs: if: always() runs-on: ubuntu-latest needs: + - changes - prettier-check - core-checks - gui-checks @@ -365,4 +396,5 @@ jobs: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: + allowed-skips: gui-checks, binary-checks, jetbrains-tests jobs: ${{ toJSON(needs) }}