From 8b0073333bca14abc7cf5d529ab852ae7f9b8740 Mon Sep 17 00:00:00 2001 From: ibuler Date: Sat, 14 Sep 2024 16:12:32 +0800 Subject: [PATCH] perf: change git workflow --- .github/workflows/build-base-image.yml | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml index 087336688..1b3366b7c 100644 --- a/.github/workflows/build-base-image.yml +++ b/.github/workflows/build-base-image.yml @@ -6,22 +6,29 @@ on: - 'pr*' jobs: - build-and-push: + check_change: runs-on: ubuntu-latest - + outputs: + should_skip: ${{ steps.set_skip_flag.outputs.should_skip }} # 输出 should_skip 标志 steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Check for changes + - name: Check conditions + id: set_skip_flag run: | - if git diff --name-only HEAD^ dev | grep -E 'poetry.lock|pyproject.toml|Dockerfile-base|package.json|go.mod|yarn.lock|pom.xml|install_deps.sh'; then - echo "Changes detected, proceeding with the job." + if git diff --name-only dev | grep -E 'poetry.lock|pyproject.toml|Dockerfile-base|package.json|go.mod|yarn.lock|pom.xml|install_deps.sh';then + echo "Found deps file changes" else - echo "No relevant changes detected, exiting." - exit 0 + echo "Not found deps file changes, skip build" + echo "::set-output name=should_skip::true" # 根据条件设置输出 fi + build-and-push: + runs-on: ubuntu-latest + needs: check_skip # 依赖 check_skip job 的执行结果 + if: needs.check_skip.outputs.should_skip != 'true' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up QEMU uses: docker/setup-qemu-action@v3