diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 52c1330..691e98d 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -3,8 +3,6 @@ on: push: branches: - master - - jobs: build: runs-on: ubuntu-latest @@ -15,28 +13,54 @@ jobs: REMOTE="https://${GITHUB_PAT}@github.com/${GITHUB_REPOSITORY}.git" COMMITER_NAME="${GITHUB_ACTOR}-github-actions" COMMITER_EMAIL="${GITHUB_ACTOR}-@users.noreply.github.com" + REMOTE_BRANCH_EXISTS=$(git ls-remote --heads ${REMOTE} ${target_branch} | wc -l) + echo "COMMITER_NAME: ${COMMITER_NAME}" echo "COMMITER_EMAIL: ${COMMITER_EMAIL}" echo "REMOTE: ${REMOTE}" + mkdir /tmp/github-pages cd /tmp/github-pages + if $keep_history && $REMOTE_BRANCH_EXISTS + then + git clone --quiet --branch ${target_branch} --depth 1 ${REMOTE} . + else git init . git checkout --orphan gh-pages - git status --short - # git ls-remote --heads ${REMOTE} gh-pages + fi + echo "