Checkout: Checking out a sub-path using git-lfs

Created on 8 Nov 2019  路  1Comment  路  Source: actions/checkout

Hi there!

(BTW -- GitHub actions, and this checkout action, are both excellent, so I want to start by saying thank you!)

At $WORK, we use a mono-repo-style repository. Therefore, our GitHub Actions events usually only affect one sub-directory of the repository. We use git-lfs to store some files, so I enabled the lfs checkout in the checkout action.

Unfortunately, this has resulted in a huge amount of LFS bandwidth on our end, sadly, so I'd like to try another approach.

I'd like either (a) a built-in way for the checkout action to only check out lfs data from some paths, or (b) to figure out how to do that myself. I'd be happy to do (b), except I can't figure out how the checkout action is authenticating to lfs to download its data.

Here's a sample YAML file that shows what I'm trying:

name: reduct-app build smoke-test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x]
    steps:
      - uses: actions/checkout@v1
        with:
          fetch-depth: 1
      - name: Get reduct-app git-lfs files
        run: |
          echo $GITHUB_TOKEN
          echo ${{ github.token }}
          echo ${{ secrets.GITHUB_TOKEN }}
          git -c http.https://github.com.extraheader="AUTHORIZATION: basic ${{ secrets.GITHUB_TOKEN }}" lfs pull --include reduct-app/
          git -c http.https://github.com.extraheader="AUTHORIZATION: basic $GITHUB_TOKEN" lfs checkout reduct-app/
        #env:
        #  GITHUB_TOKEN: ${{ secrets.CLONE_TOKEN }}
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: yarn install
        run: |
          cd reduct-app && yarn install --frozen-lockfile
      - name: yarn build
        run: |
          cd reduct-app && yarn build --all
        env:
          CI: true

Thanks!

Most helpful comment

Hi all,

I was able to accomplish what I wanted by adding this to my YAML file:

+      - name: Configure git-lfs to ignore most files
+        run: |
+          git config --global lfs.fetchinclude 'reduct-app/**'
       - uses: actions/checkout@v1

I'll happily close this for now. I do think it'd be useful for checkout to expose this as a configuration parameter someday, but it's not essential. :)

Cheers!

>All comments

Hi all,

I was able to accomplish what I wanted by adding this to my YAML file:

+      - name: Configure git-lfs to ignore most files
+        run: |
+          git config --global lfs.fetchinclude 'reduct-app/**'
       - uses: actions/checkout@v1

I'll happily close this for now. I do think it'd be useful for checkout to expose this as a configuration parameter someday, but it's not essential. :)

Cheers!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pdcmoreira picture pdcmoreira  路  3Comments

bk2204 picture bk2204  路  3Comments

aaronsteers picture aaronsteers  路  3Comments

hannesa2 picture hannesa2  路  5Comments

jcharnley picture jcharnley  路  4Comments