Files
checkout-with-lfs/action.yaml

41 lines
1.3 KiB
YAML

name: 'Checkout with LFS'
description: 'Checkout files with LFS enabled on a private Gitea repository. Normal LFS checkout fails because of header authentification'
runs:
using: 'composite'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: false
persist-credentials: true
- name: Create Git LFS file list
shell: bash
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
- name: Restore Git LFS object cache
uses: actions/cache@v5
with:
path: .git/lfs
key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }}
restore-keys: |
${{ runner.os }}-lfsdata-v1-
${{ runner.os }}-lfsdata
- name: Setup LFS
shell: bash
run: |
git lfs install --local
AUTH=$(git config http.${{ github.server_url }}/.extraheader)
git config --local --unset http.${{ github.server_url }}/.extraheader
git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH"
- name: Fetch any needed Git LFS objects and prune extraneous ones
shell: bash
run: git lfs fetch --prune
- name: Check out Git LFS content
shell: bash
run: git lfs checkout