Skip to content

Commit 1708f16

Browse files
authored
Merge pull request #35 from nordfogel/branch-input
optional branch input via GIT_REF
2 parents 986006e + 05fbec2 commit 1708f16

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inputs:
1515
description: "Username for remote repository"
1616
required: false
1717
GIT_PASSWORD:
18-
description: "The git https password or token for the remote repository"
18+
description: "The git HTTPS password or token for the remote repository"
1919
required: false
2020
GIT_SSH_PRIVATE_KEY:
2121
description: "The ssh private key for writing to the remote repository, if using ssh"
@@ -24,18 +24,22 @@ inputs:
2424
description: "The ssh public key for writing to the remote repository. Normally, not required at all"
2525
required: false
2626
GIT_SSH_KNOWN_HOSTS:
27-
description: "The contents of a SSH known_hosts file for host key verification"
27+
description: "The contents of an SSH known_hosts file for host key verification"
2828
required: false
2929
GIT_SSH_NO_VERIFY_HOST:
30-
description: "if true, skips host key verification. Mutually exclusive with GIT_SSH_KNOWN_HOSTS"
30+
description: "If true, skip host key verification. Mutually exclusive with GIT_SSH_KNOWN_HOSTS"
3131
default: "false"
3232
required: false
33+
GIT_REF:
34+
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"
35+
default: ${{ github.ref }}
36+
required: false
3337
PUSH_ALL_REFS:
3438
description: "Push all refs instead of just the current branch"
3539
default: "true"
3640
required: false
3741
GIT_PUSH_ARGS:
38-
description: "The arugments to use when pushing the repository"
42+
description: "The arguments to use when pushing the repository"
3943
default: '--tags --force --prune'
4044
required: false
4145
DEBUG:

entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ REMOTE=${INPUT_REMOTE:-"$*"}
1212
REMOTE_NAME=${INPUT_REMOTE_NAME:-"mirror"}
1313
GIT_SSH_PRIVATE_KEY=${INPUT_GIT_SSH_PRIVATE_KEY}
1414
GIT_SSH_PUBLIC_KEY=${INPUT_GIT_SSH_PUBLIC_KEY}
15+
GIT_REF=${INPUT_GIT_REF}
1516
GIT_PUSH_ARGS=${INPUT_GIT_PUSH_ARGS:-"--tags --force --prune"}
1617
GIT_SSH_NO_VERIFY_HOST=${INPUT_GIT_SSH_NO_VERIFY_HOST}
1718
GIT_SSH_KNOWN_HOSTS=${INPUT_GIT_SSH_KNOWN_HOSTS}
@@ -71,6 +72,6 @@ else
7172
echo "FATAL: You must upgrade to using actions inputs instead of args: to push a single branch" > /dev/stderr
7273
exit 1
7374
else
74-
eval git push -u ${GIT_PUSH_ARGS} ${REMOTE_NAME} "${GITHUB_REF}"
75+
eval git push -u ${GIT_PUSH_ARGS} ${REMOTE_NAME} "${GIT_REF}"
7576
fi
7677
fi

0 commit comments

Comments
 (0)