feat: testing use of docker for lfs pull

This commit is contained in:
silver 2024-09-23 13:29:59 +01:00
parent e9fe504751
commit 93d4087f76
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
3 changed files with 33 additions and 15 deletions

12
get_lfs/Dockerfile Normal file
View file

@ -0,0 +1,12 @@
# Container image that runs your code
FROM node:16-bullseye
# make sure dependencies are installed
RUN apt-get -y update
RUN apt-get -y install git git-lfs
# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -8,18 +8,9 @@ inputs:
description: 'Pass in gitea.ref_name' description: 'Pass in gitea.ref_name'
required: true required: true
runs: runs:
using: "composite" using: 'docker'
steps: image: 'Dockerfile'
- name: "Pull LFS objects" args:
shell: bash - ${{ inputs.repository }}
run: | - ${{ inputs.ref_name }}
UrlBase=$GITHUB_SERVER_URL; \ - ${{ github.server_url }}
UrlLfsBase=$UrlBase/${{ inputs.repository }}.git/info/lfs/objects; \
Auth=`git config --get --local http.$UrlBase/.extraheader`; \
git config --local http.${UrlLfsBase}/batch.extraheader "$Auth"; \
git config --local http.${UrlLfsBase}/.extraheader ''
git config --local lfs.transfer.maxretries 1
git lfs install
git lfs pull origin ${{ inputs.ref_name }}

15
get_lfs/entrypoint.sh Normal file
View file

@ -0,0 +1,15 @@
#!/bin/sh -l
export Repo=$1
export RepoRef=$2
export UrlBase=$3
export UrlLfsBase=${UrlBase}/${Repo}.git/info/lfs/objects
export Auth=$(git config --get --local http.${UrlBase}/.extraheader)
git config --local http.${UrlLfsBase}/batch.extraheader "$Auth"
git config --local http.${UrlLfsBase}/.extraheader ''
git config --local lfs.transfer.maxretries 1
git lfs install
git lfs pull origin ${RepoRef}