updating to working checkout setup
This commit is contained in:
84
action.yaml
84
action.yaml
@@ -1,79 +1,41 @@
|
||||
name: 'Checkout with LFS'
|
||||
description: 'Checkout files with LFS enabled on a private Gitea repository. Normal LFS checkout fails because of header authentification'
|
||||
|
||||
inputs:
|
||||
checkout-version:
|
||||
description: 'The version of the checkout action (e.g. "4")'
|
||||
required: false
|
||||
default: '4'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Checkout
|
||||
if: ${{ inputs.checkout-version == '3' }}
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: false
|
||||
|
||||
- name: Create LFS file list
|
||||
if: ${{ inputs.checkout-version == '3' }}
|
||||
run: /usr/bin/git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
|
||||
|
||||
- name: Restore LFS cache
|
||||
if: ${{ inputs.checkout-version == '3' }}
|
||||
uses: actions/cache@v3
|
||||
id: lfs-cache
|
||||
with:
|
||||
path: .git/lfs
|
||||
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
||||
|
||||
- name: Checkout LFS
|
||||
if: ${{ inputs.checkout-version == '3' }}
|
||||
run: |
|
||||
UrlBase=$GITHUB_SERVER_URL; \
|
||||
UrlLfsBase=$UrlBase/${{ gitea.repository }}.git/info/lfs/objects; \
|
||||
Auth=`/usr/bin/git config --get --local http.$UrlBase/.extraheader`; \
|
||||
/usr/bin/git config --local http.${UrlLfsBase}/batch.extraheader "$Auth"; \
|
||||
/usr/bin/git config --local http.${UrlLfsBase}/.extraheader ''
|
||||
|
||||
git config --local lfs.transfer.maxretries 1
|
||||
|
||||
/usr/bin/git lfs fetch origin refs/remotes/origin/${{ gitea.ref_name }}
|
||||
/usr/bin/git lfs checkout
|
||||
/usr/bin/git add .
|
||||
/usr/bin/git reset --hard
|
||||
|
||||
- name: Checkout
|
||||
if: ${{ inputs.checkout-version == '4' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: false
|
||||
persist-credentials: true
|
||||
|
||||
- name: Create LFS file list
|
||||
if: ${{ inputs.checkout-version == '4' }}
|
||||
run: /usr/bin/git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
|
||||
- name: Create Git LFS file list
|
||||
shell: bash
|
||||
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
|
||||
|
||||
- name: Restore LFS cache
|
||||
if: ${{ inputs.checkout-version == '4' }}
|
||||
uses: actions/cache@v3
|
||||
id: lfs-cache
|
||||
- name: Restore Git LFS object cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: .git/lfs
|
||||
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
||||
|
||||
- name: Checkout LFS
|
||||
if: ${{ inputs.checkout-version == '4' }}
|
||||
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: |
|
||||
UrlBase=$GITHUB_SERVER_URL; \
|
||||
UrlLfsBase=$UrlBase/${{ gitea.repository }}.git/info/lfs/objects; \
|
||||
Auth=`/usr/bin/git config --get --local http.$UrlBase/.extraheader`; \
|
||||
/usr/bin/git config --local http.${UrlLfsBase}/batch.extraheader "$Auth"; \
|
||||
/usr/bin/git config --local http.${UrlLfsBase}/.extraheader ''
|
||||
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"
|
||||
|
||||
git config --local lfs.transfer.maxretries 1
|
||||
- name: Fetch any needed Git LFS objects and prune extraneous ones
|
||||
shell: bash
|
||||
run: git lfs fetch --prune
|
||||
|
||||
/usr/bin/git lfs fetch origin refs/remotes/origin/${{ gitea.ref_name }}
|
||||
/usr/bin/git lfs checkout
|
||||
/usr/bin/git add .
|
||||
/usr/bin/git reset --hard
|
||||
- name: Check out Git LFS content
|
||||
shell: bash
|
||||
run: git lfs checkout
|
||||
Reference in New Issue
Block a user