diff --git a/action.yml b/action.yml index 5c5037a..c0894aa 100644 --- a/action.yml +++ b/action.yml @@ -15,7 +15,7 @@ inputs: description: "Username for remote repository" required: false GIT_PASSWORD: - description: "The git https password or token for the remote repository" + description: "The git HTTPS password or token for the remote repository" required: false GIT_SSH_PRIVATE_KEY: description: "The ssh private key for writing to the remote repository, if using ssh" @@ -24,18 +24,22 @@ inputs: description: "The ssh public key for writing to the remote repository. Normally, not required at all" required: false GIT_SSH_KNOWN_HOSTS: - description: "The contents of a SSH known_hosts file for host key verification" + description: "The contents of an SSH known_hosts file for host key verification" required: false GIT_SSH_NO_VERIFY_HOST: - description: "if true, skips host key verification. Mutually exclusive with GIT_SSH_KNOWN_HOSTS" + description: "If true, skip host key verification. Mutually exclusive with GIT_SSH_KNOWN_HOSTS" default: "false" required: false + GIT_REF: + description: "Push another ref rather than the current branch (GITHUB_REF) from which the action was triggered. Only effective when PUSH_ALL_REFS is false" + default: ${{ github.ref }} + required: false PUSH_ALL_REFS: description: "Push all refs instead of just the current branch" default: "true" required: false GIT_PUSH_ARGS: - description: "The arugments to use when pushing the repository" + description: "The arguments to use when pushing the repository" default: '--tags --force --prune' required: false DEBUG: diff --git a/entrypoint.sh b/entrypoint.sh index 5099097..d1b82a5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,6 +12,7 @@ REMOTE=${INPUT_REMOTE:-"$*"} REMOTE_NAME=${INPUT_REMOTE_NAME:-"mirror"} GIT_SSH_PRIVATE_KEY=${INPUT_GIT_SSH_PRIVATE_KEY} GIT_SSH_PUBLIC_KEY=${INPUT_GIT_SSH_PUBLIC_KEY} +GIT_REF=${INPUT_GIT_REF} GIT_PUSH_ARGS=${INPUT_GIT_PUSH_ARGS:-"--tags --force --prune"} GIT_SSH_NO_VERIFY_HOST=${INPUT_GIT_SSH_NO_VERIFY_HOST} GIT_SSH_KNOWN_HOSTS=${INPUT_GIT_SSH_KNOWN_HOSTS} @@ -71,6 +72,6 @@ else echo "FATAL: You must upgrade to using actions inputs instead of args: to push a single branch" > /dev/stderr exit 1 else - eval git push -u ${GIT_PUSH_ARGS} ${REMOTE_NAME} "${GITHUB_REF}" + eval git push -u ${GIT_PUSH_ARGS} ${REMOTE_NAME} "${GIT_REF}" fi fi