From 5a8ccf4a8dc5a5ae1765cf9fcae1a302055c0037 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 29 May 2026 10:51:13 -0400 Subject: [PATCH 1/4] chore(ci): ci to skip when changes are limited to workflow config files --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 00a19f512bc6..dd5efb0705c3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,7 +17,11 @@ on: push: branches: - main + paths-ignore: + - '.github/workflows/**' pull_request: + paths-ignore: + - '.github/workflows/**' name: ci jobs: # detect whether or note we should run "bulk" (non-handwritten) unit tests From 897b201625eb7c0ec2470188b406e9eeed71329f Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 29 May 2026 11:12:53 -0400 Subject: [PATCH 2/4] use dorny/paths-filter@v4 instead to avoid pending in required check --- .github/workflows/ci.yaml | 40 ++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dd5efb0705c3..5243e49d0a03 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,15 +17,33 @@ on: push: branches: - main - paths-ignore: - - '.github/workflows/**' pull_request: - paths-ignore: - - '.github/workflows/**' name: ci jobs: + filter: + runs-on: ubuntu-latest + permissions: + pull-requests: read + outputs: + runnable: ${{ steps.filter.outputs.runnable }} + steps: + - uses: actions/checkout@v6 + # Use this action, rather than a file filter so that we can make this + # mandatory. + # See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-including-branches + # for more details. + - uses: dorny/paths-filter@v4 + id: filter + with: + filters: | + runnable: + - '**' + - '!.github/workflows/**' + # detect whether or note we should run "bulk" (non-handwritten) unit tests bulk-filter: + needs: filter + if: ${{ needs.filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest permissions: pull-requests: read @@ -110,6 +128,8 @@ jobs: JOB_NAME: units-8-runtime-${{matrix.java}} # detect which libraries have changed changes: + needs: filter + if: ${{ needs.filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest permissions: pull-requests: read @@ -306,7 +326,7 @@ jobs: env: BUILD_SUBDIR: ${{matrix.package}} required: - needs: [ changes, split-units, split-clirr, split-dependencies ] + needs: [ filter, changes, split-units, split-clirr, split-dependencies ] name: conditional-required-check if: ${{ always() }} # Always run even if any "needs" jobs fail runs-on: ubuntu-22.04 @@ -317,6 +337,8 @@ jobs: - name: Success otherwise run: echo "Success!" windows: + needs: filter + if: ${{ needs.filter.outputs.runnable == 'true' }} runs-on: windows-latest steps: - name: Support longpaths @@ -333,6 +355,8 @@ jobs: JOB_TYPE: test JOB_NAME: windows-units lint: + needs: filter + if: ${{ needs.filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -349,6 +373,8 @@ jobs: HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} enforcer: + needs: filter + if: ${{ needs.filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - name: Get current week within the year @@ -368,6 +394,8 @@ jobs: - run: java -version - run: mvn -B -ntp enforcer:enforce@enforce -T 1C gapic-libraries-bom: + needs: filter + if: ${{ needs.filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -385,6 +413,8 @@ jobs: with: bom-path: gapic-libraries-bom/pom.xml generation-config-check: + needs: filter + if: ${{ needs.filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From ee5f7de6b10ea9dfcd8c104afe5c1c7216992299 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 29 May 2026 11:47:14 -0400 Subject: [PATCH 3/4] fix filter logic --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5243e49d0a03..1b2d062393f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: permissions: pull-requests: read outputs: - runnable: ${{ steps.filter.outputs.runnable }} + runnable: ${{ fromJSON(steps.filter.outputs.all_count) > fromJSON(steps.filter.outputs.workflows_count) }} steps: - uses: actions/checkout@v6 # Use this action, rather than a file filter so that we can make this @@ -36,10 +36,10 @@ jobs: id: filter with: filters: | - runnable: + all: - '**' - - '!.github/workflows/**' - + workflows: + - '.github/workflows/**' # detect whether or note we should run "bulk" (non-handwritten) unit tests bulk-filter: needs: filter From 22fe2ffd4248e382c13cf74efe3fe24ab05c432c Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 29 May 2026 13:25:04 -0400 Subject: [PATCH 4/4] consolidate with existing bulk-filter --- .github/workflows/ci.yaml | 58 ++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1b2d062393f5..54fed01215bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,19 +20,24 @@ on: pull_request: name: ci jobs: - filter: + # detect whether or note we should run "bulk" (non-handwritten) unit tests + bulk-filter: runs-on: ubuntu-latest permissions: pull-requests: read + # Set job outputs to values from filter step outputs: - runnable: ${{ fromJSON(steps.filter.outputs.all_count) > fromJSON(steps.filter.outputs.workflows_count) }} + src: ${{ steps.filter.outputs.src }} + ci: ${{ steps.filter.outputs.ci }} + # runnable is true if there are changes outside the .github/workflows directory OR if ci.yaml itself (or kokoro scripts) is modified. + runnable: ${{ fromJSON(steps.filter.outputs.all_count) > fromJSON(steps.filter.outputs.workflows_count) || fromJSON(steps.filter.outputs.ci_count) > 0 }} steps: - uses: actions/checkout@v6 # Use this action, rather than a file filter so that we can make this # mandatory. # See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-including-branches # for more details. - - uses: dorny/paths-filter@v4 + - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 id: filter with: filters: | @@ -40,23 +45,6 @@ jobs: - '**' workflows: - '.github/workflows/**' - # detect whether or note we should run "bulk" (non-handwritten) unit tests - bulk-filter: - needs: filter - if: ${{ needs.filter.outputs.runnable == 'true' }} - runs-on: ubuntu-latest - permissions: - pull-requests: read - # Set job outputs to values from filter step - outputs: - src: ${{ steps.filter.outputs.src }} - ci: ${{ steps.filter.outputs.ci }} - steps: - - uses: actions/checkout@v4 - - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 - id: filter - with: - filters: | src: - '!(google-auth-library-java|grpc-gcp-java|java-bigquery|java-bigquery-jdbc|java-bigquerystorage|java-bigtable|java-datastore|java-firestore|java-logging|java-logging-logback|java-pubsub|java-spanner|java-storage)/**/*.java' - '!(google-auth-library-java|grpc-gcp-java|java-bigquery|java-bigquery-jdbc|java-bigquerystorage|java-bigtable|java-datastore|java-firestore|java-logging|java-logging-logback|java-pubsub|java-spanner|java-storage)/**/pom.xml' @@ -68,6 +56,7 @@ jobs: units: runs-on: ubuntu-latest needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} strategy: fail-fast: false matrix: @@ -95,6 +84,7 @@ jobs: units-8-runtime: runs-on: ubuntu-latest needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} name: "units (8)" steps: - name: Get current week within the year @@ -128,15 +118,15 @@ jobs: JOB_NAME: units-8-runtime-${{matrix.java}} # detect which libraries have changed changes: - needs: filter - if: ${{ needs.filter.outputs.runnable == 'true' }} + needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest permissions: pull-requests: read outputs: packages: ${{ steps.filter.outputs.changes }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 id: filter with: @@ -326,7 +316,7 @@ jobs: env: BUILD_SUBDIR: ${{matrix.package}} required: - needs: [ filter, changes, split-units, split-clirr, split-dependencies ] + needs: [ bulk-filter, changes, split-units, split-clirr, split-dependencies ] name: conditional-required-check if: ${{ always() }} # Always run even if any "needs" jobs fail runs-on: ubuntu-22.04 @@ -337,8 +327,8 @@ jobs: - name: Success otherwise run: echo "Success!" windows: - needs: filter - if: ${{ needs.filter.outputs.runnable == 'true' }} + needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} runs-on: windows-latest steps: - name: Support longpaths @@ -355,8 +345,8 @@ jobs: JOB_TYPE: test JOB_NAME: windows-units lint: - needs: filter - if: ${{ needs.filter.outputs.runnable == 'true' }} + needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -373,8 +363,8 @@ jobs: HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} enforcer: - needs: filter - if: ${{ needs.filter.outputs.runnable == 'true' }} + needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - name: Get current week within the year @@ -394,8 +384,8 @@ jobs: - run: java -version - run: mvn -B -ntp enforcer:enforce@enforce -T 1C gapic-libraries-bom: - needs: filter - if: ${{ needs.filter.outputs.runnable == 'true' }} + needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -413,8 +403,8 @@ jobs: with: bom-path: gapic-libraries-bom/pom.xml generation-config-check: - needs: filter - if: ${{ needs.filter.outputs.runnable == 'true' }} + needs: bulk-filter + if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4