From e0761a9c1dd0d59b06d87518fee1bca650c88da3 Mon Sep 17 00:00:00 2001 From: Northword <44738481+northword@users.noreply.github.com> Date: Thu, 8 Aug 2024 22:14:44 +0800 Subject: [PATCH] Fix skip build last_commit path error --- .github/workflows/ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01c4059..597feca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,17 +32,25 @@ jobs: run: | latest_commit=$(git rev-parse HEAD) echo "Latest commit: $latest_commit" + short_commit=${latest_commit::7} + echo "short_commit: $short_commit" + + cat last_commit # Check if cached hash exists and matches the latest commit - if [[ -f ../last_commit ]] && [[ $(cat ../last_commit) == "$latest_commit" ]]; then + if [[ -f ./last_commit ]] && [[ $(cat ./last_commit) == "$latest_commit" ]]; then + need_build=false echo "No new commits. Skipping build." - echo "need_build=false" >> $GITHUB_OUTPUT else + need_build=true + echo "New commit found, need build." echo "$latest_commit" > ./last_commit - echo "short_commit=$short_commit" >> $GITHUB_OUTPUT - echo "need_build=true" >> $GITHUB_OUTPUT fi + + echo "need build: $need_build" + echo "need_build=$need_build" >> $GITHUB_OUTPUT + echo "short_commit=$short_commit" >> $GITHUB_OUTPUT build: needs: