Skip to content

Commit

Permalink
Merge pull request #35 from nordfogel/branch-input
Browse files Browse the repository at this point in the history
optional branch input via GIT_REF
  • Loading branch information
spyoungtech authored Jul 21, 2023
2 parents 986006e + 05fbec2 commit 1708f16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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

0 comments on commit 1708f16

Please sign in to comment.