From 4e7f27f51ed295e027b2d4f171f40f6f8c87620e Mon Sep 17 00:00:00 2001 From: Minimata Date: Mon, 16 Jun 2025 08:36:05 +0200 Subject: [PATCH] Initial commit --- action.yaml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 action.yaml diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..e7a5e11 --- /dev/null +++ b/action.yaml @@ -0,0 +1,48 @@ +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: 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 + - name: Checkout + if: ${{ inputs.checkout-version == '4' }} + uses: actions/checkout@v4 + with: + lfs: false + - name: Checkout LFS + if: ${{ inputs.checkout-version == '4' }} + 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 \ No newline at end of file