mirror of
https://github.com/peaceiris/actions-gh-pages.git
synced 2025-07-20 09:23:15 +08:00
feat: Add INPUT_FORCEORPHAN, close #42
This commit is contained in:
parent
7f7794a793
commit
7216888f95
@ -16,3 +16,7 @@ inputs:
|
||||
description: 'If existing files in the publish branch should be not removed before deploying'
|
||||
required: false
|
||||
default: 'false'
|
||||
forceOrphan:
|
||||
description: 'Keep only the latest commit on a GitHub Pages branch'
|
||||
required: false
|
||||
default: 'false'
|
||||
|
@ -77,7 +77,13 @@ fi
|
||||
remote_branch="${PUBLISH_BRANCH}"
|
||||
|
||||
local_dir="${HOME}/ghpages_${RANDOM}"
|
||||
if git clone --depth=1 --single-branch --branch "${remote_branch}" "${remote_repo}" "${local_dir}"; then
|
||||
|
||||
if [ -n "${INPUT_FORCEORPHAN}" ]; then
|
||||
print_info "force ophan: ${INPUT_FORCEORPHAN}"
|
||||
cd "${PUBLISH_DIR}"
|
||||
git init
|
||||
git checkout --orphan "${remote_branch}"
|
||||
elif git clone --depth=1 --single-branch --branch "${remote_branch}" "${remote_repo}" "${local_dir}"; then
|
||||
cd "${local_dir}"
|
||||
|
||||
if [[ ${INPUT_KEEPFILES} == "true" ]]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user