Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ RUN chmod +x /entrypoint.sh ;\
add-apt-repository ppa:git-core/ppa ;\
apt-get update -y ;\
apt-get install --no-install-recommends -y \
git \
git-lfs ;\
git ;\
# Install git-lfs without post-install configuration to avoid dpkg errors
apt-get download git-lfs ;\
dpkg --unpack git-lfs*.deb ;\
rm -f /var/lib/dpkg/info/git-lfs.postinst ;\
dpkg --configure git-lfs ;\
apt-get install -f --no-install-recommends -y ;\
rm git-lfs*.deb ;\
apt-get clean ;\
rm -rf /var/lib/apt/lists/*

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Features:
commit_prefix: "[AUTO]"
commit_message: "Automatic commit"
force: false
force_without_lease: false
target_branch: update/version
```

Expand All @@ -58,7 +59,8 @@ Features:
| amend | No | `false` | Whether to make amendment to the previous commit (`--amend`). Cannot be used together with `commit_message` or `commit_prefix`. |
| commit_prefix | No | `""` | Prefix added to commit message. Combines with `commit_message`. |
| commit_message | No | `""` | Commit message to set. Combines with `commit_prefix`. Cannot be used together with `amend`. |
| force | No | `false` | Whether to use force push for fast-forward changes (`--force`). Use only if necessary, e.g. when using `--amend`. And set `fetch-depth: 0` for `actions/checkout`. |
| force | No | `false` | Whether to use force push with lease (`--force-with-lease`). Use only if necessary, e.g. when using `--amend`. And set `fetch-depth: 0` for `actions/checkout`. |
| force_without_lease | No | `false` | Whether to use force push without lease (`--force`). Use only when you need to overwrite remote changes. Potentially dangerous. |
| no_edit | No | `false` | Whether to not edit commit message when using amend (`--no-edit`). |
| organization_domain | No | `github.com` | Github Enterprise domain name. |
| target_branch | No | *current branch* | Name of a new branch to push the code into. Creates branch if not existing. |
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ inputs:
description: Whether to force push
required: false
default: "false"
force_without_lease:
description: Whether to force push without lease (--force instead of --force-with-lease)
required: false
default: "false"
no_edit:
description: Whether to not edit commit message when using amend
required: false
Expand Down
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ echo " amend: ${INPUT_AMEND}"
echo " commit_prefix: ${INPUT_COMMIT_PREFIX}"
echo " commit_message: ${INPUT_COMMIT_MESSAGE}"
echo " force: ${INPUT_FORCE}"
echo " force_without_lease: ${INPUT_FORCE_WITHOUT_LEASE}"
echo " no_edit: ${INPUT_NO_EDIT}"
echo " organization_domain: ${INPUT_ORGANIZATION_DOMAIN}"
echo " target_branch: ${INPUT_TARGET_BRANCH}"
Expand Down Expand Up @@ -76,8 +77,11 @@ if [[ -n ${FILES_CHANGED} ]]; then
fi

# Push
if [[ "${INPUT_FORCE}" == "true" ]]; then
echo "[INFO] Force pushing changes"
if [[ "${INPUT_FORCE_WITHOUT_LEASE}" == "true" ]]; then
echo "[INFO] Force pushing changes without lease"
git push --force origin "${BRANCH}"
elif [[ "${INPUT_FORCE}" == "true" ]]; then
echo "[INFO] Force pushing changes with lease"
git push --force-with-lease origin "${BRANCH}"
elif [[ -n ${FILES_CHANGED} ]]; then
echo "[INFO] Pushing changes"
Expand Down