From 1dbd9c38dd113e0b68f820bceb6019fff70d110b Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Tue, 30 Jun 2026 18:34:00 +0800 Subject: [PATCH] CI: replace paths-filter with bash on rc/2.0.10 Backport the client workflow path detection change from eef45ff778 so apache/iotdb Actions startup is not blocked by the dorny/paths-filter allowlist policy on rc branch pushes. --- .github/workflows/client-cpp-package.yml | 34 ++++++--- .github/workflows/multi-language-client.yml | 79 +++++++++++++-------- 2 files changed, 73 insertions(+), 40 deletions(-) diff --git a/.github/workflows/client-cpp-package.yml b/.github/workflows/client-cpp-package.yml index 4eb889b013619..3c8c2b2844f7b 100644 --- a/.github/workflows/client-cpp-package.yml +++ b/.github/workflows/client-cpp-package.yml @@ -46,18 +46,32 @@ jobs: steps: - uses: actions/checkout@v5 if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/rc/') - - uses: dorny/paths-filter@v3 + with: + fetch-depth: 0 + - name: Detect C++ package changes id: filter if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/rc/') - with: - filters: | - cpp: - - 'iotdb-client/client-cpp/**' - - 'iotdb-client/pom.xml' - - 'iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift' - - 'iotdb-protocol/thrift-commons/src/main/thrift/common.thrift' - - '.github/workflows/client-cpp-package.yml' - - '.github/scripts/package-client-cpp-*.sh' + shell: bash + run: | + set -euo pipefail + + BASE="${{ github.event.before }}" + HEAD="${{ github.sha }}" + if [[ "$BASE" =~ ^0+$ ]]; then + BASE="$(git hash-object -t tree /dev/null)" + fi + + cpp=false + while IFS= read -r file; do + case "$file" in + iotdb-client/client-cpp/*|iotdb-client/pom.xml|iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift|iotdb-protocol/thrift-commons/src/main/thrift/common.thrift|.github/workflows/client-cpp-package.yml|.github/scripts/package-client-cpp-*.sh) + cpp=true + break + ;; + esac + done < <(git diff --name-only "$BASE" "$HEAD") + + echo "cpp=${cpp}" >> "$GITHUB_OUTPUT" - id: result shell: bash run: | diff --git a/.github/workflows/multi-language-client.yml b/.github/workflows/multi-language-client.yml index d40168e556e92..14b36af9ecf83 100644 --- a/.github/workflows/multi-language-client.yml +++ b/.github/workflows/multi-language-client.yml @@ -1,4 +1,4 @@ -# Shared client CI: run only affected language jobs via paths-filter. +# Shared client CI: run only affected language jobs via changed path detection. name: Multi-Language Client on: push: @@ -50,36 +50,55 @@ jobs: go: ${{ steps.filter.outputs.go }} steps: - uses: actions/checkout@v5 - - uses: dorny/paths-filter@v3 - id: filter with: - filters: | - cpp: - - 'iotdb-client/pom.xml' - - 'iotdb-client/client-cpp/**' - - 'iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift' - - 'iotdb-protocol/thrift-commons/src/main/thrift/common.thrift' - - '.github/workflows/multi-language-client.yml' - - '.github/workflows/client-cpp-package.yml' - - '.github/scripts/package-client-cpp-*.sh' - python: - - 'pom.xml' - - 'iotdb-client/pom.xml' - - 'iotdb-client/client-py/**' - - 'docker/src/main/Dockerfile-1c1d' - - '.github/workflows/multi-language-client.yml' - go: - - 'pom.xml' - - 'iotdb-core/**' - - 'iotdb-api/**' - - 'iotdb-protocol/**' - - 'distribution/**' - - 'integration-test/**' - - 'iotdb-client/session/**' - - 'iotdb-client/jdbc/**' - - 'iotdb-client/cli/**' - - 'iotdb-client/service-rpc/**' - - '.github/workflows/multi-language-client.yml' + fetch-depth: 0 + - name: Detect changed client paths + id: filter + shell: bash + run: | + set -euo pipefail + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.sha }}" + elif [[ "${{ github.event_name }}" == "push" ]]; then + BASE="${{ github.event.before }}" + HEAD="${{ github.sha }}" + else + echo "cpp=true" >> "$GITHUB_OUTPUT" + echo "python=true" >> "$GITHUB_OUTPUT" + echo "go=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + + if [[ "$BASE" =~ ^0+$ ]]; then + BASE="$(git hash-object -t tree /dev/null)" + fi + + cpp=false + python=false + go=false + while IFS= read -r file; do + case "$file" in + iotdb-client/pom.xml|iotdb-client/client-cpp/*|iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift|iotdb-protocol/thrift-commons/src/main/thrift/common.thrift|.github/workflows/multi-language-client.yml|.github/workflows/client-cpp-package.yml|.github/scripts/package-client-cpp-*.sh) + cpp=true + ;; + esac + case "$file" in + pom.xml|iotdb-client/pom.xml|iotdb-client/client-py/*|docker/src/main/Dockerfile-1c1d|.github/workflows/multi-language-client.yml) + python=true + ;; + esac + case "$file" in + pom.xml|iotdb-core/*|iotdb-api/*|iotdb-protocol/*|distribution/*|integration-test/*|iotdb-client/session/*|iotdb-client/jdbc/*|iotdb-client/cli/*|iotdb-client/service-rpc/*|.github/workflows/multi-language-client.yml) + go=true + ;; + esac + done < <(git diff --name-only "$BASE" "$HEAD") + + echo "cpp=${cpp}" >> "$GITHUB_OUTPUT" + echo "python=${python}" >> "$GITHUB_OUTPUT" + echo "go=${go}" >> "$GITHUB_OUTPUT" cpp: needs: changes