Skip to content

Commit

Permalink
Fix skip build last_commit path error
Browse files Browse the repository at this point in the history
  • Loading branch information
northword authored Aug 8, 2024
1 parent 018b914 commit e0761a9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e0761a9

Please sign in to comment.