updating to working checkout setup
This commit is contained in:
82
action.yaml
82
action.yaml
@@ -1,79 +1,41 @@
|
|||||||
name: 'Checkout with LFS'
|
name: 'Checkout with LFS'
|
||||||
description: 'Checkout files with LFS enabled on a private Gitea repository. Normal LFS checkout fails because of header authentification'
|
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:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- 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
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
lfs: false
|
lfs: false
|
||||||
|
persist-credentials: true
|
||||||
|
|
||||||
- name: Create LFS file list
|
- name: Create Git LFS file list
|
||||||
if: ${{ inputs.checkout-version == '4' }}
|
shell: bash
|
||||||
run: /usr/bin/git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
|
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
|
||||||
|
|
||||||
- name: Restore LFS cache
|
- name: Restore Git LFS object cache
|
||||||
if: ${{ inputs.checkout-version == '4' }}
|
uses: actions/cache@v5
|
||||||
uses: actions/cache@v3
|
|
||||||
id: lfs-cache
|
|
||||||
with:
|
with:
|
||||||
path: .git/lfs
|
path: .git/lfs
|
||||||
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-lfsdata-v1-
|
||||||
|
${{ runner.os }}-lfsdata
|
||||||
|
|
||||||
- name: Checkout LFS
|
- name: Setup LFS
|
||||||
if: ${{ inputs.checkout-version == '4' }}
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
UrlBase=$GITHUB_SERVER_URL; \
|
git lfs install --local
|
||||||
UrlLfsBase=$UrlBase/${{ gitea.repository }}.git/info/lfs/objects; \
|
AUTH=$(git config http.${{ github.server_url }}/.extraheader)
|
||||||
Auth=`/usr/bin/git config --get --local http.$UrlBase/.extraheader`; \
|
git config --local --unset http.${{ github.server_url }}/.extraheader
|
||||||
/usr/bin/git config --local http.${UrlLfsBase}/batch.extraheader "$Auth"; \
|
git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH"
|
||||||
/usr/bin/git config --local http.${UrlLfsBase}/.extraheader ''
|
|
||||||
|
|
||||||
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 }}
|
- name: Check out Git LFS content
|
||||||
/usr/bin/git lfs checkout
|
shell: bash
|
||||||
/usr/bin/git add .
|
run: git lfs checkout
|
||||||
/usr/bin/git reset --hard
|
|
||||||
Reference in New Issue
Block a user