diff --git a/build-gradle/action.yml b/build-gradle/action.yml index 434fa17..b4f475a 100644 --- a/build-gradle/action.yml +++ b/build-gradle/action.yml @@ -86,6 +86,7 @@ runs: mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/shared" .actions/shared + ln -sf "$host_actions_root/cache" .actions/cache ls -la .actions/* echo "::endgroup::" @@ -136,20 +137,16 @@ runs: if: ${{ inputs.disable-caching != 'true' }} shell: bash run: | - # Generate cache key from all Gradle files - find . \( -name '*.gradle' -o -name '*.gradle.kts' \) -type f -exec md5sum {} \; | sort > gradle-md5-sums.txt + /usr/bin/find . \( -name '*.gradle' -o -name '*.gradle.kts' \) -type f -exec md5sum {} \; > gradle-md5-sums.txt md5sum gradle/libs.versions.toml gradle/wrapper/gradle-wrapper.properties 2>/dev/null >> gradle-md5-sums.txt || true - GRADLE_CACHE_KEY=$(md5sum gradle-md5-sums.txt | awk '{ print $1 }') - echo "🔑 Generated cache key: ${GRADLE_CACHE_KEY}" echo "GRADLE_CACHE_KEY=${GRADLE_CACHE_KEY}" >> "$GITHUB_ENV" - rm -f gradle-md5-sums.txt - name: Restore Gradle Cache if: ${{ inputs.disable-caching != 'true' }} - uses: SonarSource/gh-action_cache@v1 + uses: ./.actions/cache id: gradle-cache-restore with: path: ${{ inputs.cache-paths }} diff --git a/promote/promote.sh b/promote/promote.sh index 961a8cb..26aeb7b 100755 --- a/promote/promote.sh +++ b/promote/promote.sh @@ -44,7 +44,7 @@ MULTI_REPO_SRC_PRIVATE=sonarsource-private-qa MULTI_REPO_SRC_PUBLIC=sonarsource-public-qa set_build_env() { - DEFAULT_BRANCH=${DEFAULT_BRANCH:=$(gh repo view --json defaultBranchRef --jq ".defaultBranchRef.name")} + : "${DEFAULT_BRANCH:=$(gh repo view --json defaultBranchRef --jq ".defaultBranchRef.name")}" export DEFAULT_BRANCH }