diff --git a/get_lfs/Dockerfile b/get_lfs/Dockerfile new file mode 100644 index 0000000..3a23611 --- /dev/null +++ b/get_lfs/Dockerfile @@ -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"] diff --git a/get_lfs/action.yml b/get_lfs/action.yml index 79e1fd2..4dd1157 100644 --- a/get_lfs/action.yml +++ b/get_lfs/action.yml @@ -8,18 +8,9 @@ inputs: description: 'Pass in gitea.ref_name' required: true runs: - using: "composite" - steps: - - name: "Pull LFS objects" - shell: bash - run: | - UrlBase=$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 }} + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.repository }} + - ${{ inputs.ref_name }} + - ${{ github.server_url }} diff --git a/get_lfs/entrypoint.sh b/get_lfs/entrypoint.sh new file mode 100644 index 0000000..18b266a --- /dev/null +++ b/get_lfs/entrypoint.sh @@ -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} \ No newline at end of file