1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Fix gh-actions cache not being hit issue (#191)

This commit is contained in:
Cotes Chung
2020-12-06 23:12:20 +08:00
parent cbf707dc56
commit 8d4c555638
6 changed files with 129 additions and 9 deletions

View File

@@ -15,6 +15,16 @@ _no_branch=false
_backup_dir="$(mktemp -d)"
init() {
if [[ -z ${GITHUB_ACTION+x} ]]; then
echo "ERROR: This script is not allowed to run outside of GitHub Action."
exit -1
fi
# Gemfile could be changed by `bundle install` in actions workflow
if [[ -n $(git status Gemfile.lock --porcelain) ]]; then
git checkout -- Gemfile.lock
fi
if [[ -z $(git branch -av | grep "$PAGES_BRANCH") ]]; then
_no_branch=true
git checkout -b "$PAGES_BRANCH"