Skip to content

Commit 9ca1b65

Browse files
Try to restructure cache-hit
1 parent 9c4b9ce commit 9ca1b65

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

restore.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ git clone https://${INPUT_BOT_NAME}:${INPUT_BOT_TOKEN}@github.com/${INPUT_CACHE_
1717
echo "-- Conan Cache: Enable long paths"
1818
git config --global core.longpaths true
1919

20+
hit_cache=0
21+
echo "-- Conan Cache: Setting preliminary cache-hit $hit_cache"
22+
echo "::set-output name=cache-hit::$hit_cache"
23+
2024
# Check if explicit key exits
2125
echo "-- Conan Cache: Trying explicit key $INPUT_KEY"
2226
if [ $(git tag --list "$INPUT_KEY") ]; then
2327
# If it does - check out explicit and set cache_hit to 1
2428
git checkout ${INPUT_KEY} || exit 1
2529
echo "-- Conan Cache: replace CONAN_USER_HOME_SHORT with ${CONAN_USER_HOME_SHORT}"
2630
find .conan/ -name .conan_link -exec perl -pi -e 's=CONAN_USER_HOME_SHORT=$ENV{CONAN_USER_HOME_SHORT}=g' {} +
27-
echo "::set-output name=cache-hit::1"
31+
#echo "::set-output name=cache-hit::1"
32+
hit_cache=1
2833
else
2934
# If it doesn't check if fallback exits
3035
FALLBACK_KEY="host-${RUNNER_OS}-target-${INPUT_TARGET_OS}-${REPO_BRANCH}"
@@ -40,12 +45,17 @@ else
4045
git lfs pull || exit 1
4146
echo "-- Conan Cache: replace CONAN_USER_HOME_SHORT with ${CONAN_USER_HOME_SHORT}"
4247
find .conan/ -name .conan_link -exec perl -pi -e 's=CONAN_USER_HOME_SHORT=$ENV{CONAN_USER_HOME_SHORT}=g' {} +
43-
echo "::set-output name=cache-hit::2"
48+
#echo "::set-output name=cache-hit::2"
49+
hit_cache=2
4450
else
4551
# If it doesn't - create the branch and set cache_hit to 0
4652
echo "-- Conan Cache: Creating fallback key $FALLBACK_KEY"
4753
git checkout -b ${FALLBACK_KEY} || exit 1
4854
git push -u origin ${FALLBACK_KEY} || exit 1
49-
echo "::set-output name=cache-hit::0"
55+
#echo "::set-output name=cache-hit::0"
56+
hit_cache=0
5057
fi
5158
fi
59+
60+
echo "-- Conan Cache: Setting cache-hit $hit_cache"
61+
echo "::set-output name=cache-hit::$hit_cache"

0 commit comments

Comments
 (0)