Skip to content

Commit 703f64a

Browse files
committed
add git lfs support
1 parent b79a5a3 commit 703f64a

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ The action supports the following input parameters:
6666
| `username` | Your GitLab username. | Yes | N/A |
6767
| `gitlab_pat` | Your GitLab Personal Access Token. Must have permissions to write (`write_repository` scope) to the target repository. | Yes | N/A |
6868
| `force_push` | Whether to force push to GitLab. If `true`, overwrites the destination branch. Use with caution. | No | `false` |
69+
| `git_lfs` | Whether to sync Git LFS objects to GitLab. Requires LFS to be enabled on the target GitLab repository. | No | `false` |
6970

7071
## Feedback and Contributions
7172

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ inputs:
1717
description: 'Whether to force push to GitLab. Defaults to false.'
1818
required: false
1919
default: 'false'
20+
git_lfs:
21+
description: 'Whether to sync Git LFS objects to GitLab. Defaults to false.'
22+
required: false
23+
default: 'false'
2024
runs:
2125
using: 'composite'
2226
steps:
@@ -25,6 +29,7 @@ runs:
2529
with:
2630
fetch-depth: 0
2731
persist-credentials: false
32+
lfs: ${{ inputs.git_lfs }}
2833
- name: Validate inputs
2934
run: |
3035
errors=()
@@ -62,6 +67,9 @@ runs:
6267
gitlab_repo_url_with_credentials="https://${{ inputs.username }}:${{ inputs.gitlab_pat }}@${gitlab_repo_url}"
6368
git remote add gitlab "$gitlab_repo_url_with_credentials"
6469
branch_name=$(echo $GITHUB_REF | sed 's/refs\/heads\///')
70+
if [[ "${{ inputs.git_lfs }}" == "true" ]]; then
71+
git lfs push --all gitlab
72+
fi
6573
push_command="git push gitlab $branch_name"
6674
if [[ "${{ inputs.force_push }}" == "true" ]]; then
6775
push_command="$push_command --force"

0 commit comments

Comments
 (0)